@pstdio/ui 0.44.0-nightly.20261017030225 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{MermaidComponent-b-SNuwm6.js → MermaidComponent-DhNTaUMt.js} +2 -2
- package/dist/{MermaidComponent-b-SNuwm6.js.map → MermaidComponent-DhNTaUMt.js.map} +1 -1
- package/dist/apply-theme-preference-B0vCu8zY.d.ts +26 -0
- package/dist/chat-ui.d.ts +52 -52
- package/dist/chat-ui.js +163 -161
- package/dist/chat-ui.js.map +1 -1
- package/dist/{collection-view-fields-Sa5HO5P7.d.ts → collection-view-fields-tMtZmuhS.d.ts} +0 -2
- package/dist/{collection-view-grouping-aKZhxYfX.js → collection-view-grouping-BKIr4QAb.js} +2 -2
- package/dist/{collection-view-grouping-aKZhxYfX.js.map → collection-view-grouping-BKIr4QAb.js.map} +1 -1
- package/dist/{collection-view-search-mHPkdyxT.js → collection-view-search-D7HFymZW.js} +160 -166
- package/dist/collection-view-search-D7HFymZW.js.map +1 -0
- package/dist/collection-view.d.ts +3 -90
- package/dist/collection-view.js +1 -1
- package/dist/data-table.d.ts +3 -2
- package/dist/data-table.js +98 -88
- package/dist/data-table.js.map +1 -1
- package/dist/{diff-drawer-BMl0zobj.js → diff-drawer-ByJsQg8F.js} +10 -10
- package/dist/diff-drawer-ByJsQg8F.js.map +1 -0
- package/dist/{diff-viewer-C5KXwq7E.js → diff-viewer-Cpiw-1ut.js} +4 -4
- package/dist/{diff-viewer-C5KXwq7E.js.map → diff-viewer-Cpiw-1ut.js.map} +1 -1
- package/dist/diff.js +2 -2
- package/dist/{display-sort-control-0_gG-W9g.js → display-sort-control-BuqijDAl.js} +3 -3
- package/dist/{display-sort-control-0_gG-W9g.js.map → display-sort-control-BuqijDAl.js.map} +1 -1
- package/dist/{edit-mode-data-table-BhJa4Z76.js → edit-mode-data-table-BwNTRik5.js} +147 -136
- package/dist/edit-mode-data-table-BwNTRik5.js.map +1 -0
- package/dist/host-storage-28AkEy1N.js +98 -0
- package/dist/host-storage-28AkEy1N.js.map +1 -0
- package/dist/index-3H4B61XK.d.ts +38 -0
- package/dist/{index-Bc2BsdD1.d.ts → index-Bq1BDCBk.d.ts} +6 -1
- package/dist/{index-BTABZd25.d.ts → index-DTjRTEez.d.ts} +2 -2
- package/dist/index-kYQwGcym.d.ts +91 -0
- package/dist/index.d.ts +350 -53
- package/dist/index.js +883 -880
- package/dist/index.js.map +1 -1
- package/dist/kanban-renderer.d.ts +2 -2
- package/dist/kanban-renderer.js +510 -495
- package/dist/kanban-renderer.js.map +1 -1
- package/dist/list-row-BDDAVuVd.js +1228 -0
- package/dist/list-row-BDDAVuVd.js.map +1 -0
- package/dist/{markdown-editor-hLUXSAns.js → markdown-editor-DUBUE7M-.js} +1170 -1057
- package/dist/markdown-editor-DUBUE7M-.js.map +1 -0
- package/dist/{param-editor-3B1GmtMi.js → param-editor-DK1uCOh3.js} +2 -2
- package/dist/{param-editor-3B1GmtMi.js.map → param-editor-DK1uCOh3.js.map} +1 -1
- package/dist/{param-editor-field-ZdF0maaH.js → param-editor-field-B5z6200g.js} +279 -283
- package/dist/param-editor-field-B5z6200g.js.map +1 -0
- package/dist/param-editor.js +2 -2
- package/dist/{prism-EZSmZh-a.js → prism-E3-NXX_t.js} +21 -20
- package/dist/prism-E3-NXX_t.js.map +1 -0
- package/dist/resolve-icon-component-Ck6ZyRnc.js +20 -0
- package/dist/resolve-icon-component-Ck6ZyRnc.js.map +1 -0
- package/dist/{resource-badge-nOWPqxFU.d.ts → resource-badge-DGwekS-G.d.ts} +1 -1
- package/dist/{rich-text-tfMib9o3.js → rich-text-2c_ra5gK.js} +585 -456
- package/dist/rich-text-2c_ra5gK.js.map +1 -0
- package/dist/rich-text.d.ts +1 -1
- package/dist/rich-text.js +3 -3
- package/dist/terminal.d.ts +28 -0
- package/dist/terminal.js +59 -32
- package/dist/terminal.js.map +1 -1
- package/dist/{theme-O8cKWJIk.js → theme-Chgjys_o.js} +285 -253
- package/dist/theme-Chgjys_o.js.map +1 -0
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +1 -1
- package/dist/{tree-list-Ces1hpRd.js → tree-list-B8Gtot1M.js} +99 -99
- package/dist/tree-list-B8Gtot1M.js.map +1 -0
- package/dist/{use-virtualizer-CfDHoDer.js → use-virtualizer-CqDYJolY.js} +8 -3
- package/dist/use-virtualizer-CqDYJolY.js.map +1 -0
- package/dist/{workspace-badge-CvQBU6Hs.d.ts → workspace-badge-BMjS8ii4.d.ts} +6 -1
- package/package.json +2 -2
- package/dist/collection-view-search-mHPkdyxT.js.map +0 -1
- package/dist/diff-drawer-BMl0zobj.js.map +0 -1
- package/dist/edit-mode-data-table-BhJa4Z76.js.map +0 -1
- package/dist/host-storage-BIo5azql.js +0 -31
- package/dist/host-storage-BIo5azql.js.map +0 -1
- package/dist/index-Dd6e8lU_.d.ts +0 -61
- package/dist/list-row-F8kBQGB-.js +0 -1232
- package/dist/list-row-F8kBQGB-.js.map +0 -1
- package/dist/markdown-editor-hLUXSAns.js.map +0 -1
- package/dist/param-editor-field-ZdF0maaH.js.map +0 -1
- package/dist/prism-EZSmZh-a.js.map +0 -1
- package/dist/rich-text-tfMib9o3.js.map +0 -1
- package/dist/theme-O8cKWJIk.js.map +0 -1
- package/dist/tree-list-Ces1hpRd.js.map +0 -1
- package/dist/use-virtualizer-CfDHoDer.js.map +0 -1
package/dist/chat-ui.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-ui.js","names":["useLayoutEffect","useStickToBottomContext","useConversationVisibility","$","_c","scrollRef","stopScroll","scrollToBottom","t0","t1","viewport","current","hidden","position","top","scrollTop","atTail","frame","rememberPosition","getClientRects","length","scrollHeight","clientHeight","observer","ResizeObserver","isHidden","saved","requestAnimationFrame","addEventListener","observe","cancelAnimationFrame","disconnect","removeEventListener","_c","HTMLChakraProps","IconButtonProps","AbsoluteCenter","chakra","IconButton","ArrowDownIcon","StickToBottom","StickToBottomEl","useStickToBottomContext","ScrollArea","useConversationVisibility","ConversationRootProps","React","ComponentProps","conversationRootDefaultProps","initial","resize","role","const","ConversationRoot","base","position","flex","overflow","height","forwardProps","defaultProps","ConversationContentProps","Omit","ConversationContent","props","$","_c","children","rest","contentRef","scrollRef","t0","Ref","HTMLDivElement","t1","t2","t3","Symbol","for","zIndex","layerStyle","py","t4","ConversationScrollButtonProps","conversationScrollButtonContainerDefaultProps","axis","bottom","ConversationScrollButton","isAtBottom","scrollToBottom","ChatPrimitives","Root","Viewport","ScrollToBottom","StickToBottomEl","_c","ScrollArea","HTMLChakraProps","RecipeVariantProps","createSlotRecipeContext","defineSlotRecipe","recipe","className","slots","base","root","display","width","alignItems","justifyContent","gap","mb","content","flexDirection","textStyle","overflow","borderRadius","variants","from","user","bg","px","py","assistant","developer","size","sm","md","lg","delivery","sent","unsent","opacity","shape","rounded","pill","square","defaultVariants","withProvider","withContext","VariantProps","MessageRootProps","MessageRoot","HTMLDivElement","MessageContentProps","MessageContent","ChatMessage","Root","Content","const","Box","Button","Code","Flex","HStack","Text","ShieldCheck","ShieldX","ScrollArea","ApprovalPromptProps","toolName","toolInput","onApprove","onDeny","formatToolInput","input","text","JSON","stringify","length","truncated","slice","ApprovalPrompt","props","$","_c","t0","formattedInput","t1","t2","t3","Symbol","for","t4","t5","t6","t7","t8","_c","ScrollArea","Stack","ReactNode","Fragment","ResourceBadgeProps","ResourceBadge","AttachmentListRenderBadge","props","AttachmentListItemRenderProps","attachmentId","onSelect","onRemove","size","tone","AttachmentListProps","attachments","renderBadge","DEFAULT_SIZE","NonNullable","DEFAULT_TONE","AttachmentList","$","_c","t0","t1","t2","t3","undefined","length","t4","t5","attachment","select","remove","rendered","map","_c","Fragment","useEffect","useRef","useStickToBottomContext","AutoScrollProps","userMessageCount","conversationKey","ShouldAutoScrollArgs","previousUserMessageCount","AutoScrollState","NextAutoScrollStateArgs","state","ScrollForNextAutoScrollStateArgs","scrollToBottom","animation","shouldAutoScroll","args","getNextAutoScrollState","shouldScroll","Math","max","scrollForNextAutoScrollState","next","AutoScroll","props","$","_c","t0","t1","stateRef","t2","t3","current","_c","defineSlotRecipe","chatComposerRecipe","className","slots","base","input","position","width","padding","bg","borderRadius","_focusWithin","outline","outlineOffset","workspace","display","flexDirection","gap","variants","attachedToTop","true","borderTopRadius","generateEditorStateFromString","createSerializedPromptState","input","JSON","stringify","ChatInputActionState","canInterrupt","canSubmit","hasQuestionPrompt","isDisabled","streaming","text","ChatInputAction","hasMessageText","trim","length","resolveChatInputKeyboardAction","state","resolveChatInputButtonAction","ClipboardEvent","DragEvent","DEFAULT_TEXT_ATTACHMENT_PASTE_LINE_THRESHOLD","shouldAttachPastedText","text","lineThreshold","length","split","createAttachmentEventHandlers","input","onAttachFiles","files","File","onAttachText","textAttachmentPasteLineThreshold","onPasteCapture","event","HTMLDivElement","Array","from","clipboardData","preventDefault","pastedText","getData","onDropCapture","dataTransfer","onDragOver","types","includes","IconButton","IconButtonProps","Kbd","Portal","Tooltip","ArrowUp","Pause","SendButtonProps","shortcut","title","canInterrupt","SendButton","props","$","_c","rest","ariaLabel","t0","icon","t1","button","t2","tooltipContent","t3","t4","t5","_c","_Fragment","Button","HStack","ReactNode","ScrollArea","ChatInputAction","COMPOSER_CONTROL_HEIGHT","SendButton","ChatInputToolbarProps","actions","submitActions","questionPrompt","skipDisabled","skipTitle","onSkip","buttonAction","submitTitle","submitLabel","messageTitle","runAction","action","ChatInputToolbar","props","$","_c","t0","t1","t2","undefined","t3","_c","ScrollArea","ReactNode","ChatInputQuestionResponse","ComposerDecision","id","controls","model","pending","actions","label","variant","disabled","onAction","actionId","Promise","ComposerResponseInput","response","text","attachments","onSubmit","onClearAttachments","submitComposerResponse","input","OTHER_CHOICE_LABEL","OTHER_CHOICE_VALUE","getOwnQuestionValue","values","Record","T","key","Object","hasOwn","undefined","questionOffersOtherChoice","question","options","allowCustomAnswer","Boolean","length","getOwnQuestionValue","ChatInputQuestionOption","label","description","ChatInputQuestion","id","question","options","multiple","required","allowCustomAnswer","ChatInputQuestionPrompt","questions","callId","delivery","ChatInputQuestionResponse","answers","ChatInputQuestionCustomAnswers","Record","getQuestionSelectionKey","index","isQuestionOtherSelected","customAnswersByQuestion","questionIndex","Object","hasOwn","clearQuestionOtherAnswer","_removed","rest","toggleQuestionOtherAnswer","SKIPPED_QUESTION_TEXT","toQuestionResponse","questionPrompt","buildSkippedQuestionResponse","toggleQuestionOptionSelection","selectedOptionsByQuestion","optionLabel","key","selected","alreadySelected","includes","filter","getQuestionPromptSignature","JSON","stringify","map","Boolean","option","answersForQuestion","selectedLabels","customAnswer","typed","trim","getAnswersForQuestion","getQuestionAnswerLines","lines","length","push","join","isCustomAnswersByQuestion","value","toCustomAnswersByQuestion","answerInput","trimmed","fromEntries","flatMap","buildQuestionResponse","legacyText","hasCustomQuestions","some","buildQuestionAnswerValues","hasMissingRequiredQuestionAnswer","Button","Check","Tooltip","ChatInputQuestion","ChatInputQuestionCustomAnswers","getAnswersForQuestion","getQuestionSelectionKey","QuestionStepTabProps","question","questionIndex","isActive","selectedOptionsByQuestion","Record","customAnswersByQuestion","onSelectStep","hasQuestionAnswer","key","length","QuestionStepTab","props","$","_c","t0","isAnswered","stepStateLabel","tabVariant","t1","id","t2","t3","t4","t5","t6","t7","_c","Tooltip","SessionMessage","ToolPart","QuestionFormBlockOption","QuestionFormBlockQuestion","isRecord","value","Record","Array","isArray","parseJsonObjectText","parsed","JSON","parse","toInputRecord","input","trim","length","getStringValue","getQuestionResponseText","stringValue","lines","map","filter","line","join","response","answer","text","answers","carriesAnswers","hasQuestionResponse","parseQuestionOption","label","description","undefined","parseQuestion","index","question","options","option","type","declaredCustomAnswer","allowCustomAnswer","custom","id","multiple","required","parseQuestionPrompt","record","questions","delivery","const","isQuestionTool","part","tool","toLowerCase","orderedQuestionRequests","messages","requests","Map","message","role","parts","set","callId","values","getQuestionRequestKey","stringify","state","isPendingQuestion","status","output","metadata","questionPromptFor","prompt","resolveQuestionPrompt","key","find","resolveActiveQuestionPrompt","getQuestionBubbleAnswer","split","section","startsWith","slice","getStringValue","isQuestionTool","createContext","useContext","useState","getQuestionRequestKey","resolveQuestionPrompt","SessionMessage","ToolPart","QuestionSelection","conversationKey","key","index","revision","QuestionNavigation","activeKey","selection","open","part","selectStep","close","ChatQuestionNavigationContext","undefined","useQuestionNavigation","useChatQuestionNavigation","messages","$","_c","setSelection","current","t0","prompt","t1","t2","t3","previous","t4","t5","Symbol","for","index_0","previous_0","t6","t7","t8","value","_c","Box","Stack","Text","Textarea","FormEvent","ReactNode","Checkbox","Radio","RadioGroup","getOwnQuestionValue","OTHER_CHOICE_LABEL","OTHER_CHOICE_VALUE","questionOffersOtherChoice","QuestionFormBlockQuestion","TodoListBlockItem","preventSubmit","event","preventDefault","QuestionFormBlockViewProps","questions","editable","selectedOptionsByQuestion","Record","customAnswersByQuestion","onToggleOption","question","questionIndex","optionLabel","onToggleOther","onCustomAnswerChange","answer","QuestionOptionContent","props","$","_c","option","t0","label","t1","description","t2","QuestionCheckboxOptionRow","name","checked","onToggle","undefined","tabIndex","t3","t4","t5","QuestionRadioOptions","selectedOption","otherSelected","otherField","hasOtherChoice","options","findIndex","selectedIndex","selectedValue","String","details","value","Number","t6","t7","option_0","optionIndex","map","t8","t9","TodoListBlockView","items","_temp","QuestionFieldsetProps","selectedOptions","customAnswer","QuestionOtherField","editablePlaceholder","currentTarget","QuestionCheckboxOptions","includes","QuestionFieldset","id","allowCustomAnswer","hasChoices","length","multiple","QuestionFormBlockView","item","index","_c","Checkbox","RadioGroup","_temp","_Fragment","HStack","Stack","useEffect","useRef","useState","ChatInputQuestion","ChatInputQuestionCustomAnswers","ChatInputQuestionPrompt","getQuestionPromptSignature","getQuestionSelectionKey","isQuestionOtherSelected","QuestionStepTab","useQuestionNavigation","getOwnQuestionValue","QuestionFormBlockView","QuestionPromptControlsProps","isEditable","questionPrompt","selectedOptionsByQuestion","Record","customAnswersByQuestion","onToggleOption","question","questionIndex","optionLabel","onToggleOther","onCustomAnswerChange","answer","QuestionPromptStepperProps","questions","ReturnType","toQuestionFormQuestions","map","index","id","options","multiple","Boolean","required","allowCustomAnswer","QuestionPromptStepper","props","$","_c","activeQuestionIndex","setActiveQuestionIndex","questionPanelRef","navigation","selection","focusRevision","revision","t0","t1","undefined","current","focus","t2","selectStep","renderQuestionIndex","Math","min","length","activeQuestion","hasMultipleQuestions","t3","t4","t5","t6","t7","t8","t9","_question","_questionIndex","question_0","selectedOptions","hadSelection","t10","t11","_question_0","_questionIndex_0","t12","t13","t14","QuestionPromptControls","questionPromptSignature","_c","useEffect","useRef","useState","buildQuestionAnswerValues","buildQuestionResponse","ChatInputQuestion","ChatInputQuestionCustomAnswers","ChatInputQuestionPrompt","clearQuestionOtherAnswer","getQuestionPromptSignature","getQuestionSelectionKey","hasMissingRequiredQuestionAnswer","toggleQuestionOptionSelection","toggleQuestionOtherAnswer","defaultSelections","prompt","Object","fromEntries","questions","flatMap","question","index","delivery","options","length","label","useQuestionPromptState","questionPrompt","resetToken","selectedOptionsByQuestion","setSelectedOptionsByQuestion","Record","customAnswersByQuestion","setCustomAnswersByQuestion","signature","previousResetRef","JSON","stringify","reset","current","toggleOption","questionIndex","optionLabel","multiple","toggleOther","setCustomAnswer","answer","key","restore","selected","custom","responseText","hasMissingRequiredAnswer","buildAnswers","Button","ReactNode","useRef","useState","ChatInputAction","buildSkippedQuestionResponse","ChatInputQuestionPrompt","ChatInputQuestionResponse","QuestionPromptControls","SKIPPED_QUESTION_TEXT","toQuestionResponse","ChatInputToolbar","useQuestionNavigation","useQuestionPromptState","ChatInputQuestionFormProps","prompt","actions","disabled","onSubmit","text","response","Promise","ChatInputQuestionForm","props","$","_c","question","navigation","submitting","setSubmitting","inFlight","t0","t1","skip","undefined","current","hasMissingRequiredAnswer","sent","selectedOptions","selectedOptionsByQuestion","customAnswers","customAnswersByQuestion","responseText","buildAnswers","reset","restore","submit","t2","setCustomAnswer","toggleOption","toggleOther","t3","delivery","close","t4","t5","t6","t7","t8","action","t9","t10","_c","_Fragment","Button","Flex","HStack","Text","useRef","useState","COMPOSER_CONTROL_HEIGHT","ComposerDecision","ComposerDecisionToolbarProps","decision","disabled","ComposerDecisionToolbar","props","submitting","setSubmitting","inFlight","choose","actionId","action","actions","find","item","id","current","pending","onAction","controls","model","map","variant","label","ReactNode","ChatInputQuestionForm","ChatInputQuestionPrompt","ChatInputQuestionResponse","getQuestionPromptSignature","ComposerDecision","ComposerDecisionToolbar","ComposerRequest","ComposerTakeoverProps","request","question","decision","actions","disabled","submitDisabled","onSubmit","answer","response","Promise","ComposerTakeover","props","$","_c","kind","t0","id","t1","t2","_c","useState","useComposerFocus","autoFocus","focusSignal","$","_c","requested","setRequested","t0","source","setSource","t1","t2","Symbol","for","t3","request","complete","_c","SessionMessage","MAX_RECENT_USER_PROMPTS","getRecentUserPrompts","messages","prompts","i","length","message","role","text","parts","flatMap","part","type","join","trim","push","movePromptHistory","index","direction","count","Math","min","useEffect","useRef","PromptEditorRef","MAX_RECENT_USER_PROMPTS","movePromptHistory","ChatInputHistoryOptions","recentUserMessages","text","blocked","resetKey","onChange","useChatInputHistory","options","$","_c","editorRef","historyIndex","prompts","t0","slice","signature","JSON","stringify","resetSignature","previousResetSignature","t1","t2","current","t3","Symbol","for","reset","t4","value","change","t5","direction","movement","length","index","value_0","setEditorValue","recall","t6","t7","t8","recallPrevious","recallNext","_c","useState","getTextFromSerializedEditorState","useChatInputText","defaultState","$","_c","adoptedState","setAdoptedState","editorState","setEditorState","editorKey","setEditorKey","t0","text","setText","t1","Symbol","for","state","_temp","remountEditor","nextText","t2","key","_c","_temp","ChatInputQuestionPrompt","getQuestionPromptSignature","ComposerDecision","ComposerRequest","kind","id","resolveComposerRequest","question","decision","Pick","active","waiting","push","callId","find","request","useState","ChatInputQuestionPrompt","ComposerDecision","ComposerRequest","resolveComposerRequest","useComposerRequest","question","decision","active","setActive","request","kind","id","Box","Flex","Text","useSlotRecipe","MouseEvent","ReactNode","useState","ScrollArea","chatComposerRecipe","PromptCommand","PromptEditor","PromptSelectionSnapshot","createSerializedPromptState","ChatInputAction","resolveChatInputButtonAction","resolveChatInputKeyboardAction","createAttachmentEventHandlers","DEFAULT_TEXT_ATTACHMENT_PASTE_LINE_THRESHOLD","ChatInputQuestionPrompt","ChatInputQuestionResponse","ChatInputToolbar","COMPOSER_CONTROL_HEIGHT","ComposerDecision","submitComposerResponse","ComposerTakeover","useComposerFocus","useChatInputHistory","useChatInputText","useComposerRequest","ChatInputProps","defaultState","recentUserMessages","placeholder","onSubmit","text","attachments","questionResponse","Promise","onInterrupt","onAttachFiles","files","File","onAttachText","textAttachmentPasteLineThreshold","streaming","attachedResources","onClearAttachments","isDisabled","submitDisabled","onChange","attachmentList","actions","submitActions","attachmentActions","attachedToTop","questionPrompt","decision","autoFocus","focusSignal","submitTitle","submitLabel","initialSelection","onSelectionChange","selection","onEditorStateChange","state","retainTextUntilAcknowledged","commands","ChatInputPlaceholder","props","$","_c","t0","ChatInput","request","occupied","Boolean","styles","recipe","submitting","setSubmitting","editorKey","editorState","remountEditor","setEditorState","setText","focus","history","blocked","resetKey","String","value","handleContainerClick","event","HTMLDivElement","target","Element","currentTarget","contains","closest","replaceDraftText","change","canSubmit","actionState","canInterrupt","hasQuestionPrompt","buttonAction","messageTitle","submitMessage","trim","sentText","reset","runAction","action","attachmentEventHandlers","input","undefined","onPasteCapture","onDropCapture","onDragOver","answer","response","pr","editorRef","recallPrevious","recallNext","requested","complete","nextText","JSON","stringify","_c","ScrollArea","_Fragment","useRef","MessageAnimationState","initialized","seenKeys","Set","NextMessageAnimationStateArgs","itemKeys","state","messageFadeInProps","animationName","animationDuration","animationTimingFunction","const","getNextMessageAnimationState","args","animatedKeys","key","has","add","itemKeysEqual","a","b","length","index","useMessageAnimationKeys","stateRef","lastResultRef","current","next","Box","HStack","IconButton","Text","Check","Copy","useEffect","useRef","useState","Tooltip","ChatMessagePart","SessionMessage","MessageActionPanelProps","message","alwaysVisible","copyAlwaysVisible","isCopyablePart","part","Extract","type","getMessageCopyText","parts","filter","map","text","trim","Boolean","join","getMessageTimestampLabel","locale","timeZone","delivery","createdAt","Intl","DateTimeFormat","hour","minute","format","Date","MessageActionPanel","props","$","_c","t0","t1","undefined","isCopied","setIsCopied","copyResetTimeoutRef","t2","copyText","t3","timestampLabel","t4","t5","Symbol","for","current","window","clearTimeout","t6","navigator","clipboard","writeText","setTimeout","copyMessage","t7","t8","t9","t10","messageActionPanelHoverStyles","t11","opacity","pointerEvents","_c","Tooltip","BoxProps","Box","RichMessage","ChatLinkProps","ChatRichContentProps","Omit","children","streaming","ChatRichContent","props","$","_c","linkHandler","rest","t0","t1","Response","_c","chakra","Stack","useRecipe","ArrowRight","chatQuestionBubbleRecipe","getQuestionBubbleAnswer","getQuestionRequestKey","isPendingQuestion","parseQuestionPrompt","useQuestionNavigation","ToolPart","ChatQuestionBubbleProps","part","ChatQuestionBubble","props","$","_c","prompt","state","input","navigation","t0","Symbol","for","recipe","t1","pending","canOpen","Boolean","T0","t2","t3","t4","question","index","answer","options","label","expanded","activeKey","selection","id","multiline","includes","undefined","open","t5","questions","map","t6","_c","normalizeToolName","value","replace","toLowerCase","getToolNameLookupKeys","normalized","compact","Set","LucideIcon","AlertTriangle","CircleQuestionMark","DotIcon","File","FileDiff","FileDown","FilePen","FileText","FileUp","Globe","ListTodo","ListTree","Move","Search","Terminal","Trash2","normalizeToolName","toolIconMap","shell","ls","read_file","write_file","delete_file","patch","upload_files","download_file","move_file","const","Record","iconMap","dot","danger","search","browser","file","question","todo","terminal","IconName","ToolIconName","DEFAULT_TOOL_ICON","isToolIconName","value","Object","hasOwn","getIconComponent","name","toolTypeToIconName","type","normalized","compact","replace","getFileTypeIcon","TitleSegment","FileChange","filePath","additions","deletions","basenameSafe","path","idx","lastIndexOf","slice","normalizeHeaderPath","input","token","split","trim","normalized","startsWith","replace","isMinusHeader","line","isPlusHeader","isHunkHeader","isAddedLine","isDeletedLine","ensureFileChange","changes","Map","has","set","incrementAdditions","current","get","incrementDeletions","UnifiedDiffState","currentPath","lastMinusHeader","inHunk","processUnifiedDiffLine","state","plusPath","parseUnifiedDiff","diffText","lines","Array","from","entries","map","buildDiffTitleSegments","file","kind","fileName","extractDiffFilePaths","FileDiffPreview","original","modified","isDiffFileBoundary","isInvalidHunkBodyLine","appendHunkLine","text","push","parseHunkBody","startIndex","index","length","parsePreview","oldHeader","next","nextIndex","const","newHeader","preview","join","buildFileDiffPreviews","previews","i","Math","max","ToolPart","Block","TitleSegment","basenameSafe","buildDiffTitleSegments","buildFileDiffPreviews","extractDiffFilePaths","toolTypeToIconName","TOOL_LABELS","Record","apply_patch","bash","edit","glob","grep","read","skill","todowrite","STATE_LABELS","error","input_streaming","running","completed","failed","ApplyPatchMetadataFile","filePath","additions","deletions","diff","before","after","normalizeToolType","value","replace","toLowerCase","toTitleCase","split","filter","token","length","map","toUpperCase","slice","join","getToolType","invocation","tool","getToolLabel","normalized","getStateLabel","state","status","includes","isErrorState","buildIndicator","type","icon","const","buildBaseTitle","detail","labelOverride","detailStyle","label","title","kind","text","bold","push","muted","truncate","monospace","stateLabel","getInputObject","input","Array","isArray","getOutputObject","output","getStringValue","trim","getObjectValue","getStateObject","key","normalizeFilePath","isUnifiedDiff","getApplyPatchMetadataObjects","metadata","Boolean","parseApplyPatchMetadataFile","entry","record","rawPath","relativePath","path","undefined","getApplyPatchMetadataFiles","files","entries","parsedFile","getApplyPatchInputFilePaths","changes","filePaths","change","from","Set","getApplyPatchDiffText","inputDiff","metadataDiff","fileDiffs","file","patchText","buildApplyPatchMetadataTitleSegments","seen","segments","has","add","fileName","getApplyPatchMetadataReferences","getOutputText","outputObject","returnDisplay","preview","stdout","content","parseSkillContentBlock","match","skillName","getSkillName","name","skill_name","buildFileLinkSegment","variant","prependErrorBlock","blocks","errorText","errorBlock","getDiffBlocks","diffText","language","original","modified","sideBySide","getDiffTitleSegments","getDiffReferences","STATE_LABELS","toTitleCase","getToolLabel","getStateLabel","isErrorState","buildIndicator","getStringValue","getObjectValue","Block","Item","buildApplyPatchMetadataTitleSegments","buildBaseTitle","buildFileLinkSegment","buildIndicator","getApplyPatchDiffText","getApplyPatchInputFilePaths","getApplyPatchMetadataFiles","getApplyPatchMetadataReferences","getDiffBlocks","getDiffReferences","getDiffTitleSegments","prependErrorBlock","ToolRenderer","renderApplyPatch","invocation","diffText","metadataFiles","inputFilePaths","title","undefined","diffSegments","length","push","map","filePath","blocks","file","before","after","type","language","original","modified","sideBySide","references","indicator","buildIndicator","Block","Item","buildBaseTitle","buildFileLinkSegment","buildIndicator","getDiffBlocks","getInputObject","getOutputObject","getStringValue","prependErrorBlock","ToolRenderer","buildEditDiff","original","modified","type","language","sideBySide","renderEdit","invocation","input","output","filePath","file_path","undefined","oldString","old_string","newString","new_string","title","push","diffBlocks","diff","indicator","blocks","getStringValue","buildIndicator","ToolPart","Block","Item","TitleSegment","hasQuestionResponse","parseQuestionPrompt","ToolRenderer","QuestionRendererDependencies","buildBaseTitle","invocation","detail","labelOverride","buildIndicator","prependErrorBlock","blocks","createQuestionRenderer","deps","responded","state","output","metadata","prompt","input","block","type","questions","fieldLabel","length","undefined","indicator","title","expandable","Block","Item","buildBaseTitle","buildFileLinkSegment","buildIndicator","getInputObject","getOutputObject","getOutputText","getSkillName","getStringValue","parseSkillContentBlock","prependErrorBlock","ToolRenderer","renderRead","invocation","input","output","filePath","file_path","file","path","undefined","title","push","indicator","blocks","renderCommand","Parameters","label","command","outputText","type","language","code","stderr","exitCode","text","renderBash","renderShell","renderGrep","query","pattern","renderGlob","references","split","map","line","trim","filter","length","renderSkill","parsedOutput","skillName","renderedContent","content","getStringValue","buildIndicator","ToolPart","Block","Item","TitleSegment","ToolRenderer","TodoItem","label","checked","TodowriteRendererDependencies","buildBaseTitle","invocation","detail","labelOverride","buildIndicator","prependErrorBlock","blocks","getStringValue","value","trim","length","getObjectValue","Array","isArray","Record","parseTodoItem","todo","content","title","status","parseTodoItems","items","explicit","listSource","objectValue","todos","map","filter","createTodowriteRenderer","deps","inputTodos","state","input","outputTodos","output","todoState","countLabel","indicator","type","text","renderApplyPatch","renderEdit","createQuestionRenderer","buildBaseTitle","buildIndicator","prependErrorBlock","renderBash","renderGlob","renderGrep","renderRead","renderShell","renderSkill","createTodowriteRenderer","ToolRenderersMap","renderQuestion","renderTodowrite","createDefaultToolRenderers","apply_patch","bash","edit","glob","grep","question","read","shell","skill","todo_write","todowrite","ToolPart","Block","Item","TitleSegment","toolTypeToIconName","getToolNameLookupKeys","normalizeToolName","createDefaultToolRenderers","ToolRenderersMap","ToolTimelineBuilderOptions","STATE_LABELS","Record","error","toTitleCase","value","split","filter","token","length","map","toUpperCase","slice","join","getToolLabel","tool","normalized","replace","isErrorState","state","buildIndicator","invocation","status","type","icon","const","getStateLabel","includes","stringifyValue","undefined","JSON","stringify","isBlankValue","trim","Array","isArray","every","Object","values","getRecord","getString","getMediaType","record","mime_type","mediaType","mimeType","isImageMediaType","Boolean","startsWith","imageUrlPattern","getImageBlock","alt","data","src","url","test","getFileLikeOutput","filePath","path","filename","content","body","text","extensionLanguageBySuffix","css","html","js","json","jsx","md","py","ts","tsx","yaml","yml","getLanguageFromPath","extension","pop","toLowerCase","createLabeledBlocks","label","blocks","buildBlocksForArrayValue","entry","entryRecord","entryType","image","push","buildBlocksForValue","buildBlocksForFileLikeValue","fileLikeOutput","language","code","buildBlocksForAttachmentValue","attachmentName","attachment_name","attachmentId","attachment_file_id","attachmentFileId","imageBlock","fileBlocks","attachmentBlocks","buildGenericBlocks","toolLabel","errorText","input","output","createGenericItem","title","kind","bold","stateLabel","muted","indicator","isVisibleTitleSegment","segment","fileName","isVisibleBlock","block","original","modified","items","questions","references","isVisibleItem","item","hasTitle","some","hasBlocks","mergeToolRenderers","overrides","getRenderer","toolRenderers","rawTool","key","renderer","renderInvocation","options","rendered","buildTimelineDocFromInvocations","invocations","ComponentProps","lazy","Suspense","Editor","then","module","default","DiffEditor","props","$","_c","t0","_c","Avatar","Timeline","ChakraTimeline","Span","getIconComponent","Indicator","IndicatorView","props","$","_c","ind","type","t0","icon","IndicatorIcon","t1","alt","src","Symbol","for","t2","_c","ChakraTimeline","Avatar","Link","Span","MouseEvent","DiffBubble","Tooltip","ChatLinkAnchor","useChatLinkHandler","TitleSegment","handleTitleLinkClick","event","HTMLAnchorElement","seg","Extract","kind","onOpenFile","filePath","stopPropagation","href","preventDefault","AvatarTitleSegment","t0","$","_c","t1","alt","src","t2","Symbol","for","t3","DiffTitleSegment","additions","deletions","fileName","path","t4","BubbleLinkTitleSegment","fontWeight","bold","undefined","isInteractive","Boolean","muted","t5","t6","textDecoration","color","t7","text","DefaultLinkTitleSegment","TextTitleSegment","isClickable","monospace","truncate","t8","t9","segment","t10","TitleInline","handler","source","origin","variant","_c","Tooltip","Box","Button","Card","Timeline","ChakraTimeline","Image","Span","Stack","Text","ChevronUpIcon","ReactNode","useState","DiffEditor","ResourceBadge","ScrollArea","ChatLinkProps","ChatLinkAnchor","ChatLinkProvider","useChatLinkHandler","IconName","IndicatorView","TitleInline","QuestionFormBlockView","TodoListBlockView","TimelineDoc","items","Item","id","timestamp","indicator","Indicator","title","TitleSegment","blocks","Block","expandable","type","icon","color","src","alt","kind","text","bold","muted","truncate","monospace","fileName","filePath","additions","deletions","href","variant","TodoListBlockItem","label","checked","QuestionFormBlockOption","description","QuestionFormBlockQuestion","question","options","multiple","required","allowCustomAnswer","reactions","clap","language","code","editable","original","modified","sideBySide","placeholder","questions","references","caption","render","ctx","onOpenFile","CodeBlock","t0","$","_c","t1","t2","t3","BlockView","b","map","_temp","trim","ref","source","origin","TimelineItemRow","item","itemKey","isOpen","canExpand","hasBlocks","onToggle","Symbol","for","t4","length","undefined","seg","i","t5","block","i_0","t6","t7","TimelineFromJSONProps","data","TimelineFromJSON","props","inherited","linkHandler","TimelineContent","handler","path","open","openFile","expanded","setExpanded","getKey","_temp2","key","prev","toggle","idx_0","key_0","idx","it","Timeline","ChakraTimeline","_c","ScrollArea","_temp","_Fragment","_temp2","ChatLinkProps","buildTimelineDocFromInvocations","normalizeToolName","ToolPart","TimelineFromJSON","ToolInvocationTimelineProps","invocations","labeledBlocks","hideQuestionForms","onOpenFile","filePath","isQuestionTool","invocation","tool","replace","hasToolOutput","output","state","trim","length","Array","isArray","Object","keys","undefined","ToolInvocationTimeline","props","$","_c","t0","linkHandler","t1","t2","Symbol","for","bb0","visibleInvocations","filter","_temp","data","t3","_c","_temp","Box","Image","Spinner","ReactNode","AlertMessage","ResourceBadge","RichMessage","ChatImageSourcesContext","emptyChatImageSources","indexChatImageSources","useChatImageHistory","ChatLinkProps","ChatLinkProvider","useChatLinkHandler","parseQuestionPrompt","Response","ChatQuestionBubble","AlertPart","ChatMessagePart","ErrorPart","FilePart","SessionMessage","ToolPart","ToolInvocationTimeline","ToolInvocationTimelineProps","ToolInvocationTimelineComponent","props","MessagePartsProps","message","streaming","hideQuestionForms","onOpenFile","filePath","toolInvocationTimeline","isToolPart","part","type","filePartLabel","filename","url","split","pop","imageExtensionPattern","isImageFilePart","mediaType","startsWith","test","filePartThumbnail","undefined","openFilePart","window","open","getErrorMessage","trim","length","errorType","ALERT_COLOR_PALETTE","Record","info","warning","error","success","loading","collectToolInvocations","parts","startIndex","invocations","lookahead","nextPart","tool","state","input","push","nextIndex","MessagePartsRenderer","$","_c","inherited","t0","linkHandler","t1","t2","MessagePartsContent","imageHistory","localImages","RenderToolInvocationTimeline","t3","nodes","partIndex","key","id","bb0","get","text","color","fontSize","fontWeight","status","title","_c","_Fragment","SessionMessageRole","TextPart","type","text","ReasoningPart","ToolPartActionType","ToolPartStatus","ToolPart","tool","callId","actionType","status","state","input","output","errorText","metadata","StepStartPart","snapshot","StepFinishPart","reason","cost","tokens","PatchPart","hash","files","FilePart","fileId","mediaType","filename","size","url","LoadingPart","ErrorPart","errorType","message","TokenUsagePart","inputTokens","outputTokens","cacheReadTokens","cacheWriteTokens","AlertPart","title","SessionMessagePart","ChatMessagePart","SessionMessage","id","role","parts","index","createdAt","delivery","modelId","providerId","reasoning","cache","read","write","QueuedFollowUp","sending","revision","model","params","Record","steeringUnavailableReason","steeringDelivery","runStartedAt","prompt","attachments","Array","name","position","MessageOrigin","getMessageOrigin","isReasoningToolOnlyMessage","length","hasTextPart","some","part","isVisibleText","trim","isVisibleAlert","Boolean","isDisplayRenderablePart","isActivityPart","toLowerCase","isActivityOnlyMessage","every","mergeBufferedActivity","messages","first","rest","flatMap","at","mergeReasoningToolOnlyMessages","merged","previous","push","normalizeChatMessagesForDisplay","options","streaming","normalized","activityBuffer","clearActivityBuffer","displayParts","filter","displayMessage","activity","trailingActivity","MessageGroup","userMessage","responses","getAssistantMessageActionTargetId","lastMessage","hasVisibleText","groupMessagesByTurn","groups","leadingResponses","Button","Flex","useSlotRecipe","ReactNode","ChatMessage","messageFadeInProps","MessageActionPanel","MessagePartsRenderer","getMessageOrigin","SessionMessage","ChatMessageListResponseProps","message","streaming","hideQuestionForms","animate","showAssistantActions","ChatMessageListResponse","props","$","_c","t0","t1","undefined","t2","role","from","showActions","t3","t4","t5","t6","t7","t8","StickyMessageToggleProps","expanded","label","onClick","actionPanel","StickyMessageToggle","Symbol","for","key","recipe","styles","footer","_c","getAssistantMessageActionTargetId","MessageGroup","SessionMessage","ChatMessageRow","key","message","type","endIndex","userIndex","showAssistantActions","isActiveTurn","buildChatMessageRows","leadingResponses","groups","leadingActionId","rows","map","id","length","groupIndex","group","entries","actionId","responses","push","userMessage","getChatStickyRowIndex","index","row","hasChatRowGap","next","Boolean","SCROLL_BOUNDARY_EPSILON","StickyUserMessageScrollElement","clientHeight","scrollHeight","scrollTop","shouldStopStickyUserMessageWheel","element","deltaY","maxScrollTop","Math","max","Box","useSlotRecipe","useLayoutEffect","useRef","useState","WheelEvent","ScrollArea","ChatMessage","messageFadeInProps","StickyMessageToggle","shouldStopStickyUserMessageWheel","MessageActionPanel","MessagePartsRenderer","SessionMessage","StickyUserMessageProps","message","expanded","animate","onToggle","messageId","handleWheel","event","HTMLElement","currentTarget","deltaY","stopPropagation","StickyUserMessage","props","$","_c","viewportRef","bodyRef","previewRef","collapsible","setCollapsible","isExpanded","t0","Symbol","for","key","recipe","t1","styles","t2","t3","undefined","t4","viewport","css","onWheel","viewportProps","t5","t6","body","current","preview","measure","getBoundingClientRect","height","observer","ResizeObserver","observe","disconnect","t7","t8","scrollTop","t9","actions","t10","delivery","t11","t12","t13","t14","t15","t16","t17","id","t18","root","t19","_c","ScrollArea","useEffect","useLayoutEffect","useRef","TAIL_READY_STABLE_FRAME_COUNT","TAIL_READY_FRAME_LIMIT","TAIL_READY_PIXEL_EPSILON","TailLayoutSnapshot","scrollTop","totalSize","isTailLayoutStable","current","previous","Math","abs","tailFitsViewport","scrollElement","HTMLElement","Boolean","max","scrollHeight","clientHeight","readTailLayoutSnapshot","useTailReady","input","$","_c","itemCount","onReady","scrollRef","onReadyRef","t0","t1","t2","t3","requestAnimationFrame","frameId","checkedFrameCount","stableFrameCount","previousSnapshot","waitForStableTail","nextSnapshot","cancelAnimationFrame","_c","Box","defaultRangeExtractor","useStickToBottomContext","useVirtualizer","useMessageAnimationKeys","ChatMessageListResponse","buildChatMessageRows","getChatStickyRowIndex","hasChatRowGap","MessageGroup","SessionMessage","StickyUserMessage","useTailReady","ChatMessageListProps","leadingResponses","groups","streaming","hideActiveQuestionForms","expandedStickyMessageIds","Set","onToggleStickyMessage","messageId","onReady","ESTIMATED_MESSAGE_HEIGHT","VIRTUAL_LIST_OVERSCAN","VIRTUAL_LIST_GAP","ChatMessageList","props","scrollRef","rows","animatedKeys","map","row","key","initialHeight","current","clientHeight","gapCount","Math","max","length","virtualizer","HTMLDivElement","count","getScrollElement","estimateSize","index","getItemKey","overscan","initialRect","width","height","initialOffset","rangeExtractor","range","indexes","stickyIndex","startIndex","includes","unshift","totalSize","getTotalSize","measurements","measurementsCache","itemCount","getVirtualItems","virtualItem","type","end","endIndex","top","start","size","measureElement","undefined","message","has","isActiveTurn","showAssistantActions","useVirtualizer","useEffect","useState","PromptSelectionSnapshot","createSerializedPromptState","ChatInputQuestionResponse","QueuedFollowUp","QueuedFollowUpComposerInput","queuedFollowUps","defaultValue","onChange","text","onSubmit","attachments","questionResponse","Promise","onUpdate","itemId","prompt","onCreate","onRestoreDraft","canRestoreDraft","disabled","onSelect","item","onDiscard","useQueuedFollowUpComposer","input","editingItem","setEditingItem","edits","setEdits","Record","state","draftState","setDraftState","focusSignal","setFocusSignal","selections","setSelections","error","setError","updating","setUpdating","recoveredItemId","setRecoveredItemId","notice","setNotice","savedItem","find","id","createNew","Boolean","stale","revision","inputValue","savedDraftState","undefined","editorState","select","signal","trim","length","current","draft","next","change","changeState","discard","submit","Error","failure","message","selectionKey","initialSelection","changeSelection","selection","draftValue","edit","selectDraft","editingItemId","isEditing","dirtyItemIds","Object","keys","filter","Box","Button","Text","createSerializedPromptState","ChatInput","ChatPanelComposerProps","QueuedComposerInputProps","editing","hasQueuedFollowUps","QueuedComposerInput","props","$","_c","conversationKey","recentUserMessages","actions","attachmentActions","attachedResources","attachmentList","chatInputAutoFocus","chatInputPlaceholder","chatInputQuestionPrompt","composerDecision","chatInputCommands","inputDisabled","submitDisabled","onAttachFiles","onAttachText","onClearAttachments","onInterrupt","queuedComposer","streaming","actionLabel","createNew","updateLabel","updating","t0","event","key","defaultPrevented","nativeEvent","isComposing","currentTarget","contains","target","Node","preventDefault","stopPropagation","discard","t1","editingItemId","t2","editorState","inputValue","t3","t4","undefined","t5","t6","t7","stale","t8","t9","t10","t11","change","changeSelection","changeState","focusSignal","initialSelection","submit","t12","t13","QueuedComposerNotice","notice","error","failure","Boolean","_c","Box","Text","useSlotRecipe","KeyboardCoordinateGetter","useDroppable","ArrowUp","queuedFollowUpRecipe","QueuedFollowUp","queueKeyboardCoordinates","event","KeyboardEvent","context","Parameters","onTarget","id","keys","includes","code","undefined","preventDefault","targets","droppableContainers","getEnabled","sort","a","b","Number","data","current","order","index","findIndex","target","over","next","length","Math","max","min","rect","droppableRects","get","x","left","width","collisionRect","y","top","height","QueueDropZone","props","item","kind","drop","disabled","Boolean","sending","steeringDelivery","indexOf","position","before","combine","after","bottom","setNodeRef","QueueSendNow","visible","targeted","reason","styles","recipe","sendNowHit","sendNow","Box","HStack","IconButton","Stack","Text","useSlotRecipe","useDraggable","GripVertical","Trash2","ReactNode","useEffect","useRef","useState","DropIndicator","queuedFollowUpRecipe","QueuedFollowUp","QueueDropZone","QueuedFollowUpRowProps","item","index","editor","source","destination","unavailableReason","editing","onEdit","onRemove","id","QueuedFollowUpRow","props","disabled","Boolean","sending","steeringDelivery","drag","data","styles","recipe","hovered","setHovered","focused","setFocused","exit","ReturnType","setTimeout","undefined","row","HTMLDivElement","clearTimeout","current","scrollIntoView","block","reveal","compact","node","setNodeRef","event","pointerType","currentTarget","contains","relatedTarget","target","Element","closest","setActivatorNodeRef","listeners","attributes","handle","stopPropagation","content","prompt","model","Object","values","params","map","String","attachments","attachment","name","filter","join","notice","actions","Box","Text","useSlotRecipe","DndContext","KeyboardSensor","PointerSensor","pointerWithin","rectIntersection","useSensor","useSensors","Fragment","ReactNode","useState","ScrollArea","queuedFollowUpRecipe","QueuedFollowUp","QueueSendNow","queueKeyboardCoordinates","QueuedFollowUpMoveDirection","QueuedFollowUpRow","QueuedFollowUpListProps","items","editingItemId","editor","retainedEditor","retainedEditorPosition","dirtyItemIds","steeringUnavailableReason","onEdit","item","onRemove","itemId","onMove","direction","steps","selection","source","Promise","onSteer","onCombine","target","settingsKey","JSON","stringify","model","Object","entries","params","sort","a","b","localeCompare","QueuedFollowUpList","props","$","_c","t0","t1","undefined","t2","Symbol","for","recipe","t3","t4","styles","keyboardTarget","setKeyboardTarget","t5","activationConstraint","distance","t6","coordinateGetter","event","context","sensors","setSource","t7","dragItems","setDragItems","destination","setDestination","error","setError","pending","setPending","length","t8","getRetainedEditorIndex","retainedIndex","t9","includes","id","steerReason","showSendNow","Boolean","t10","steeringDelivery","combineReason","t11","selected","target_0","kind","eligible","filter","_temp","start","findIndex","item_0","end","item_1","insertion","next","Math","abs","reorder","t12","selected_0","target_1","performDrop","t13","args","pointerCoordinates","pointer","t14","event_0","active","data","current","t15","t16","event_1","over","t17","event_2","selected_1","target_2","resolve","then","catch","failure","Error","message","finally","t18","root","t19","t20","t21","maxH","t22","t23","item_2","index","map","t24","t25","notice","t26","t27","position","Number","POSITIVE_INFINITY","RetainedEditor","children","row","sending","_c","_temp","Fragment","ScrollArea","Box","Stack","useSlotRecipe","ReactNode","chatComposerRecipe","queuedFollowUpRecipe","useQueuedFollowUpComposer","PromptCommand","ChatInputQuestionPrompt","ComposerDecision","QueuedFollowUp","QueuedComposerInput","QueuedFollowUpList","QueuedFollowUpMoveDirection","ChatPanelComposerProps","conversationKey","recentUserMessages","actions","attachmentActions","composerHeader","attachedResources","attachmentList","chatInputAutoFocus","chatInputPlaceholder","chatInputQuestionPrompt","composerDecision","chatInputCommands","hasWorkspaceHub","inputDisabled","submitDisabled","onAttachFiles","files","File","onAttachText","text","onClearAttachments","onInterrupt","onQueuedFollowUpMove","itemId","direction","steps","selection","source","items","onQueuedFollowUpRemove","onQueuedFollowUpUpdate","prompt","Promise","onQueuedFollowUpSteer","item","onQueuedFollowUpCombine","target","queueSteeringUnavailableReason","unsavedQueueItemIds","queuedComposer","ReturnType","queuedFollowUps","streaming","workspaceHub","ChatPanelComposer","props","$","_c","t0","t1","undefined","t2","Symbol","for","recipe","t3","t4","styles","t5","t6","t7","workspace","composerStyles","hasQueuedFollowUps","length","editing","isEditing","t8","editor","t9","t10","createNew","t11","editingItem","position","t12","dirtyItemIds","t13","edit","t14","editingItemId","t15","draftValue","selectDraft","draft","t16","_c","HStack","Spinner","Text","useEffect","useState","formatElapsed","totalSeconds","seconds","Math","max","floor","minutes","String","padStart","hours","WorkingIndicator","props","$","_c","startedAt","hidden","t0","undefined","mountedAt","Date","now","setNow","t1","t2","updateElapsed","timer","setInterval","clearInterval","t3","Symbol","for","t4","t5","t6","_c","Box","Flex","MessageCircleIcon","ReactNode","useState","EmptyState","PromptCommand","ChatImageHistoryContext","indexChatImageSources","ChatLinkProps","ChatLinkProvider","resolveActiveQuestionPrompt","ChatPrimitives","AutoScroll","getRecentUserPrompts","ChatInputQuestionPrompt","ChatInputQuestionResponse","ChatMessageList","ChatPanelComposer","useQueuedFollowUpComposer","ChatQuestionNavigationContext","useChatQuestionNavigation","ComposerDecision","groupMessagesByTurn","normalizeChatMessagesForDisplay","QueuedFollowUp","SessionMessage","QueuedFollowUpMoveDirection","WorkingIndicator","ChatPanelProps","conversationKey","messages","loading","streaming","streamingStartedAt","emptyStateTitle","emptyStateDescription","emptyStateContent","loaderComponent","chatInputPlaceholder","chatInputDefaultValue","onSubmitMessage","text","attachments","questionResponse","Promise","onInterrupt","onAttachFiles","files","File","onAttachText","onChatInputChange","actions","attachmentActions","composerHeader","attachedResources","onClearAttachments","attachmentList","approvalPrompt","conversationNotices","workspaceHub","workspaceInitializing","inputDisabled","submitDisabled","chatInputQuestionPrompt","composerDecision","chatInputAutoFocus","queuedFollowUps","onQueuedFollowUpUpdate","itemId","prompt","onQueuedFollowUpCreate","onQueuedFollowUpRestoreDraft","canRestoreQueuedEditToDraft","onQueuedFollowUpSelect","item","onQueuedFollowUpDiscard","onQueuedFollowUpSteer","onQueuedFollowUpCombine","source","target","queueSteeringUnavailableReason","unsavedQueueItemIds","onQueuedFollowUpRemove","onQueuedFollowUpMove","direction","steps","selection","items","chatInputCommands","ChatPanel","props","$","_c","linkHandler","t0","t1","t2","t3","t4","t5","t6","t7","t8","undefined","t9","t10","hasMessages","messageListIdentity","messageListKey","t11","userMessageCount","merged","length","id","reduce","_temp","groups","leadingResponses","expandedStickyMessageIds","setExpandedStickyMessageIds","_temp2","readyMessageListKey","setReadyMessageListKey","showLoadingState","t12","Symbol","for","t13","defaultEmptyContent","emptyContent","hasWorkspaceHub","Boolean","questionNavigation","t14","activeQuestionPrompt","hideActiveQuestionForms","showThinkingIndicator","isMessageViewportReady","t15","defaultValue","onChange","onSubmit","onUpdate","onCreate","onRestoreDraft","canRestoreDraft","disabled","onSelect","onDiscard","queuedComposer","t16","messageId","current","next","Set","has","delete","add","toggleStickyMessageExpanded","t17","t18","value","t19","t20","t21","t22","t23","t24","t25","t26","t27","t28","t29","t30","t31","t32","t33","t34","t35","count","message","role","_c","_temp","EmptyState","defaultEmptyContent","_Fragment","Skeleton","Stack","ChatMessage","SkeletonLinesProps","widths","SkeletonLines","props","$","_c","t0","map","_temp","t1","ChatSkeleton","Symbol","for","width","index","_c","Box","chakra","Flex","Portal","Stack","Text","PointerEvent","useState","ConversationBrowseItem","id","message","reply","ConversationBrowseProps","items","onSelect","floating","MIN_USER_MESSAGES","TICK_MIN_WIDTH","TICK_MAX_WIDTH","LENS_RADIUS","BrowseCardPosition","left","top","lensFactor","index","pointerIndex","distance","Math","abs","cos","PI","tickColor","ConversationBrowseCard","props","$","_c","item","position","t0","t1","t2","t3","t4","t5","ConversationBrowse","undefined","setPointerIndex","cardPosition","setCardPosition","length","event","rect","currentTarget","getBoundingClientRect","fraction","clientY","height","next","min","max","nextActiveIndex","round","right","handlePointerMove","activeIndex","activeItem","Symbol","for","insetInlineStart","bottom","bg","map","t6","t7","_c","Button","chakra","Field","HStack","Icon","Input","Menu","Popover","Portal","Stack","Tag","Text","useSlotRecipe","useState","ListRow","getIconComponent","Tooltip","HarnessAction","id","label","icon","argument","value","HarnessMode","description","state","indicator","tone","tagText","closeActionId","confirmation","title","actionId","cancelLabel","actions","LocalTag","onClose","closeLabel","HarnessControlsProps","modes","draftTag","sentTag","pending","unavailable","onRequestConfirmation","modeId","onAction","modeSnapshot","Promise","LocalModeTag","props","$","_c","tag","t0","t1","t2","t3","t4","t5","t6","NativeModeTag","mode","Symbol","for","key","styles","editing","setEditing","setArgument","open","setOpen","action","find","closeAction","action_0","undefined","invoke","status","placement","details","t7","t8","t9","t10","t11","t12","t13","t14","t15","t16","t17","t18","event","target","trim","t19","t20","map","action_1","t21","content","t22","HarnessControls","_c","Tooltip","getIconComponent","Flex","HStack","Spinner","Text","AlertTriangle","ReactNode","WorkspaceHubStatus","ChatWorkspaceHubProps","workspaceControl","additions","deletions","action","status","statusLabel","HubStatus","props","$","_c","t0","Symbol","for","t1","t2","ChatWorkspaceHub","undefined","t3","t4","_c","AlertMessage","Tooltip$1","ScrollArea$1","Checkbox$1","ListRow","useVirtualizer$1","ResourceBadge","DropIndicator","EmptyState$1","getIconComponent$1","RadioGroup$1","Radio","chatQuestionBubbleRecipe","queuedFollowUpRecipe","ChatLinkProvider","ChatImageSourcesContext","useChatImageHistory","parseChatLink","ChatImageHistoryContext","indexChatImageSources","useChatLinkHandler","ChatLinkAnchor","emptyChatImageSources","generateEditorStateFromString","getTextFromSerializedEditorState","RichMessage","PromptEditor","DiffBubble","Fragment$1","useConversationVisibility","$","c","useStickToBottomContext","t0","t1","scrollRef","scrollToBottom","stopScroll","viewport","hidden","position","frame","rememberPosition","observer","saved","useLayoutEffect","ConversationRoot","chakra","StickToBottom","ConversationContent","children","rest","props","contentRef","t2","t3","t4","conversationScrollButtonContainerDefaultProps","ChatPrimitives","isAtBottom","AbsoluteCenter","IconButton","ArrowDownIcon","recipe","defineSlotRecipe","createSlotRecipeContext","ChatMessage","withProvider","withContext","formatToolInput","input","text","ApprovalPrompt","toolInput","formattedInput","toolName","Text","Code","ShieldX","onDeny","Button","t5","ShieldCheck","t6","onApprove","t7","HStack","t8","Box","Flex","DEFAULT_SIZE","DEFAULT_TONE","AttachmentList","attachments","size","tone","onRemove","onSelect","renderBadge","select","attachment","remove","rendered","Stack","shouldAutoScroll","args","previousUserMessageCount","userMessageCount","getNextAutoScrollState","conversationKey","scrollForNextAutoScrollState","next","AutoScroll","stateRef","useRef","useEffect","chatComposerRecipe","createSerializedPromptState","hasMessageText","resolveChatInputKeyboardAction","state","isDisabled","canSubmit","resolveChatInputButtonAction","streaming","hasQuestionPrompt","canInterrupt","shouldAttachPastedText","lineThreshold","createAttachmentEventHandlers","onAttachFiles","event","files","pastedText","onAttachText","textAttachmentPasteLineThreshold","SendButton","shortcut","title","ariaLabel","Pause","ArrowUp","icon","button","Fragment","Kbd","tooltipContent","Tooltip","Portal","ChatInputToolbar","actions","onSkip","questionPrompt","skipDisabled","skipTitle","buttonAction","messageTitle","runAction","submitLabel","submitTitle","submitActions","submitComposerResponse","OTHER_CHOICE_LABEL","OTHER_CHOICE_VALUE","getOwnQuestionValue","values","key","questionOffersOtherChoice","question","getQuestionSelectionKey","index","isQuestionOtherSelected","customAnswersByQuestion","questionIndex","clearQuestionOtherAnswer","_removed","toggleQuestionOtherAnswer","SKIPPED_QUESTION_TEXT","toQuestionResponse","buildSkippedQuestionResponse","toggleQuestionOptionSelection","selected","selectedOptionsByQuestion","alreadySelected","optionLabel","label","getQuestionPromptSignature","option","answersForQuestion","typed","customAnswer","selectedLabels","getAnswersForQuestion","getQuestionAnswerLines","lines","answers","isCustomAnswersByQuestion","value","toCustomAnswersByQuestion","answerInput","trimmed","buildQuestionResponse","legacyText","hasCustomQuestions","buildQuestionAnswerValues","hasMissingRequiredQuestionAnswer","hasQuestionAnswer","QuestionStepTab","isAnswered","stepStateLabel","tabVariant","isActive","onSelectStep","Check","isRecord","parseJsonObjectText","parsed","toInputRecord","getStringValue$2","getQuestionResponseText","stringValue","line","carriesAnswers","hasQuestionResponse","parseQuestionOption","parseQuestion","options","type","declaredCustomAnswer","allowCustomAnswer","parseQuestionPrompt","record","questions","isQuestionTool$1","part","orderedQuestionRequests","requests","message","messages","getQuestionRequestKey","isPendingQuestion","questionPromptFor","prompt","resolveQuestionPrompt","resolveActiveQuestionPrompt","getQuestionBubbleAnswer","answer","section","ChatQuestionNavigationContext","createContext","useQuestionNavigation","useContext","useChatQuestionNavigation","selection","setSelection","useState","current","previous","previous_0","index_0","preventSubmit","QuestionOptionContent","QuestionCheckboxOptionRow","editable","onToggle","checked","name","QuestionRadioOptions","hasOtherChoice","selectedOption","selectedIndex","otherSelected","onToggleOption","onToggleOther","details","optionIndex","option_0","otherField","t9","TodoListBlockView","items","_temp$6","QuestionOtherField","editablePlaceholder","onCustomAnswerChange","Textarea","QuestionCheckboxOptions","selectedOptions","QuestionFieldset","hasChoices","QuestionFormBlockView","item","toQuestionFormQuestions","QuestionPromptStepper","activeQuestionIndex","setActiveQuestionIndex","questionPanelRef","navigation","focusRevision","selectStep","renderQuestionIndex","activeQuestion","hasMultipleQuestions","question_0","hadSelection","t10","t11","t12","isEditable","t13","t14","QuestionPromptControls","questionPromptSignature","defaultSelections","useQuestionPromptState","setSelectedOptionsByQuestion","setCustomAnswersByQuestion","signature","previousResetRef","resetToken","custom","current_0","current_1","current_2","questionIndex_0","current_3","question_1","questionIndex_1","current_4","ChatInputQuestionForm","submitting","setSubmitting","inFlight","disabled","onSubmit","skip","sent","response","submit","action","ComposerDecisionToolbar","choose","decision","actionId","action_0","ComposerTakeover","request","submitDisabled","useComposerFocus","requested","setRequested","autoFocus","focusSignal","source","setSource","getRecentUserPrompts","prompts","i","movePromptHistory","count","direction","useChatInputHistory","editorRef","historyIndex","blocked","recentUserMessages","resetKey","resetSignature","previousResetSignature","reset","onChange","change","movement","value_0","recall","useChatInputText","adoptedState","setAdoptedState","defaultState","editorState","setEditorState","editorKey","setEditorKey","setText","_temp$5","remountEditor","nextText","resolveComposerRequest","waiting","active","useComposerRequest","setActive","ChatInputPlaceholder","placeholder","ChatInput","occupied","styles","useSlotRecipe","focus","history","handleContainerClick","target","replaceDraftText","actionState","onInterrupt","submitMessage","sentText","retainTextUntilAcknowledged","attachedResources","attachmentEventHandlers","attachmentList","onEditorStateChange","attachmentActions","messageFadeInProps","getNextMessageAnimationState","animatedKeys","seenKeys","itemKeysEqual","a","b","useMessageAnimationKeys","lastResultRef","itemKeys","isCopyablePart","getMessageCopyText","getMessageTimestampLabel","locale","MessageActionPanel","alwaysVisible","copyAlwaysVisible","isCopied","setIsCopied","copyResetTimeoutRef","copyText","timestampLabel","copyMessage","messageActionPanelHoverStyles","jsx","Copy","Response","linkHandler","ChatQuestionBubble","useRecipe","pending","canOpen","T0","expanded","ArrowRight","normalizeToolName","getToolNameLookupKeys","normalized","compact","toolIconMap","Terminal","ListTree","FileText","FilePen","Trash2","FileDiff","FileUp","FileDown","Move","iconMap","DotIcon","AlertTriangle","Search","Globe","File","CircleQuestionMark","ListTodo","DEFAULT_TOOL_ICON","isToolIconName","getIconComponent","toolTypeToIconName","basenameSafe","idx","path","normalizeHeaderPath","token","isMinusHeader","isPlusHeader","isHunkHeader","isAddedLine","isDeletedLine","ensureFileChange","changes","filePath","incrementAdditions","incrementDeletions","processUnifiedDiffLine","currentPath","parseUnifiedDiff","diffText","buildDiffTitleSegments","file","extractDiffFilePaths","isDiffFileBoundary","isInvalidHunkBodyLine","appendHunkLine","original","modified","parseHunkBody","startIndex","parsePreview","oldHeader","buildFileDiffPreviews","previews","preview","nextIndex","TOOL_LABELS","STATE_LABELS$1","normalizeToolType","toTitleCase$1","getToolType","invocation","getToolLabel$1","getStateLabel$1","isErrorState$1","buildIndicator$1","buildBaseTitle","labelOverride","detail","detailStyle","stateLabel","getInputObject","getOutputObject","output","getStringValue$1","getObjectValue$1","getStateObject","normalizeFilePath","isUnifiedDiff","getApplyPatchMetadataObjects","parseApplyPatchMetadataFile","entry","rawPath","getApplyPatchMetadataFiles","metadata","entries","parsedFile","getApplyPatchInputFilePaths","filePaths","getApplyPatchDiffText","inputDiff","metadataDiff","fileDiffs","diff","patchText","buildApplyPatchMetadataTitleSegments","seen","segments","getApplyPatchMetadataReferences","getOutputText","outputObject","parseSkillContentBlock","match","getSkillName","buildFileLinkSegment","variant","prependErrorBlock","blocks","getDiffBlocks","getDiffTitleSegments","getDiffReferences","renderApplyPatch","metadataFiles","inputFilePaths","diffSegments","references","buildEditDiff","renderEdit","diffBlocks","createQuestionRenderer","deps","responded","block","fieldLabel","buildIndicator","renderRead","renderCommand","outputText","stderr","renderBash","renderShell","renderGrep","renderGlob","renderSkill","parsedOutput","renderedContent","getStringValue","getObjectValue","parseTodoItem","todo","content","parseTodoItems","listSource","objectValue","createTodowriteRenderer","inputTodos","outputTodos","todoState","todos","countLabel","renderQuestion","renderTodowrite","createDefaultToolRenderers","STATE_LABELS","toTitleCase","getToolLabel","tool","isErrorState","getStateLabel","stringifyValue","isBlankValue","getRecord","getString","getMediaType","isImageMediaType","imageUrlPattern","getImageBlock","mediaType","data","url","getFileLikeOutput","extensionLanguageBySuffix","getLanguageFromPath","extension","createLabeledBlocks","buildBlocksForArrayValue","entryRecord","entryType","image","alt","buildBlocksForValue","buildBlocksForFileLikeValue","fileLikeOutput","buildBlocksForAttachmentValue","attachmentName","attachmentId","imageBlock","fileBlocks","attachmentBlocks","buildGenericBlocks","toolLabel","createGenericItem","isVisibleTitleSegment","segment","isVisibleBlock","isVisibleItem","hasTitle","hasBlocks","mergeToolRenderers","overrides","getRenderer","rawTool","renderer","toolRenderers","renderInvocation","buildTimelineDocFromInvocations","invocations","Editor","lazy","n","module","DiffEditor","Suspense","IndicatorView","ind","IndicatorIcon","Timeline","Span","Avatar","handleTitleLinkClick","stopPropagation","seg","onOpenFile","AvatarTitleSegment","DiffTitleSegment","BubbleLinkTitleSegment","fontWeight","isInteractive","Link","DefaultLinkTitleSegment","TextTitleSegment","isClickable","TitleInline","Timeline$1","CodeBlock","language","code","BlockView","Card","_temp$4","Image","ref","TimelineItemRow","isOpen","canExpand","itemKey","ChevronUpIcon","i_0","TimelineFromJSON","inherited","TimelineContent","handler","openFile","setExpanded","getKey","_temp2$1","prev","toggle","key_0","idx_0","it","isQuestionTool","hasToolOutput","ToolInvocationTimeline","hideQuestionForms","labeledBlocks","visibleInvocations","_temp$3","isToolPart","filePartLabel","imageExtensionPattern","isImageFilePart","filePartThumbnail","openFilePart","getErrorMessage","errorType","ALERT_COLOR_PALETTE","collectToolInvocations","lookahead","parts","nextPart","MessagePartsRenderer","MessagePartsContent","imageHistory","toolInvocationTimeline","localImages","RenderToolInvocationTimeline","nodes","partIndex","Spinner","getMessageOrigin","role","isVisibleText","isVisibleAlert","isDisplayRenderablePart","isActivityPart","isActivityOnlyMessage","mergeBufferedActivity","first","normalizeChatMessagesForDisplay","activityBuffer","clearActivityBuffer","displayParts","displayMessage","activity","trailingActivity","getAssistantMessageActionTargetId","lastMessage","groupMessagesByTurn","groups","leadingResponses","ChatMessageListResponse","animate","from","showActions","showAssistantActions","StickyMessageToggle","onClick","actionPanel","buildChatMessageRows","leadingActionId","rows","groupIndex","group","userIndex","getChatStickyRowIndex","row","hasChatRowGap","SCROLL_BOUNDARY_EPSILON","shouldStopStickyUserMessageWheel","maxScrollTop","element","deltaY","handleWheel","StickyUserMessage","viewportRef","bodyRef","previewRef","collapsible","setCollapsible","isExpanded","viewportProps","body","measure","t15","t16","t17","t18","t19","TAIL_READY_STABLE_FRAME_COUNT","TAIL_READY_FRAME_LIMIT","TAIL_READY_PIXEL_EPSILON","isTailLayoutStable","tailFitsViewport","scrollElement","totalSize","readTailLayoutSnapshot","useTailReady","onReadyRef","onReady","itemCount","frameId","checkedFrameCount","stableFrameCount","previousSnapshot","waitForStableTail","nextSnapshot","ESTIMATED_MESSAGE_HEIGHT","VIRTUAL_LIST_OVERSCAN","VIRTUAL_LIST_GAP","ChatMessageList","initialHeight","gapCount","virtualizer","indexes","defaultRangeExtractor","range","stickyIndex","measurements","row_0","virtualItem","end","expandedStickyMessageIds","onToggleStickyMessage","hideActiveQuestionForms","useQueuedFollowUpComposer","editingItem","setEditingItem","edits","setEdits","draftState","setDraftState","setFocusSignal","selections","setSelections","error","setError","updating","setUpdating","recoveredItemId","setRecoveredItemId","notice","setNotice","savedItem","queuedFollowUps","createNew","stale","inputValue","defaultValue","savedDraftState","item_0","signal","canRestoreDraft","onRestoreDraft","signal_0","changeState","text_0","discard","onDiscard","next_0","questionResponse","text_1","onCreate","onUpdate","next_1","failure","selectionKey","current_5","item_1","id","item_2","QueuedComposerInput","actionLabel","queuedComposer","updateLabel","editing","inputDisabled","hasQueuedFollowUps","chatInputAutoFocus","chatInputCommands","chatInputPlaceholder","chatInputQuestionPrompt","composerDecision","onClearAttachments","QueuedComposerNotice","queueKeyboardCoordinates","targets","context","rect","onTarget","QueueDropZone","drop","useDroppable","kind","QueueSendNow","visible","reason","targeted","QueuedFollowUpRow","drag","useDraggable","hovered","setHovered","focused","setFocused","exit","reveal","editor","node","destination","unavailableReason","event_0","event_1","onEdit","event_2","GripVertical","event_3","settingsKey","QueuedFollowUpList","dirtyItemIds","keyboardTarget","setKeyboardTarget","sensors","useSensors","useSensor","PointerSensor","KeyboardSensor","dragItems","setDragItems","setDestination","setPending","retainedEditor","retainedEditorPosition","getRetainedEditorIndex","retainedIndex","onSteer","steeringUnavailableReason","steerReason","showSendNow","combineReason","onMove","eligible","_temp$2","start","target_0","insertion","reorder","onCombine","target_1","selected_0","performDrop","pointer","pointerWithin","rectIntersection","selected_1","target_2","t20","t21","t22","editingItemId","t23","RetainedEditor","t24","t25","t26","t27","DndContext","ChatPanelComposer","unsavedQueueItemIds","hasWorkspaceHub","composerStyles","onQueuedFollowUpUpdate","onQueuedFollowUpCombine","onQueuedFollowUpMove","onQueuedFollowUpRemove","onQueuedFollowUpSteer","queueSteeringUnavailableReason","composerHeader","workspaceHub","formatElapsed","seconds","totalSeconds","minutes","WorkingIndicator","mountedAt","now","setNow","updateElapsed","timer","startedAt","ChatPanel","loading","chatInputDefaultValue","workspaceInitializing","hasMessages","messageListIdentity","messageListKey","merged","_temp$1","setExpandedStickyMessageIds","_temp2","readyMessageListKey","setReadyMessageListKey","showLoadingState","MessageCircleIcon","emptyStateDescription","emptyStateTitle","emptyContent","loaderComponent","emptyStateContent","questionNavigation","activeQuestionPrompt","showThinkingIndicator","isMessageViewportReady","canRestoreQueuedEditToDraft","onChatInputChange","onQueuedFollowUpCreate","onQueuedFollowUpDiscard","onQueuedFollowUpRestoreDraft","onQueuedFollowUpSelect","onSubmitMessage","messageId","toggleStickyMessageExpanded","conversationNotices","streamingStartedAt","t28","t29","t30","t31","approvalPrompt","t32","t33","t34","t35","SkeletonLines","widths","_temp","ChatSkeleton","Skeleton","width","MIN_USER_MESSAGES","TICK_MIN_WIDTH","LENS_RADIUS","lensFactor","pointerIndex","distance","tickColor","ConversationBrowseCard","ConversationBrowse","floating","setPointerIndex","cardPosition","setCardPosition","fraction","nextActiveIndex","handlePointerMove","activeIndex","activeItem","LocalModeTag","tag","Menu","Tag","NativeModeTag","setEditing","argument","setArgument","open","setOpen","mode","closeAction","onAction","modeSnapshot","invoke","status","unavailable","Popover","Field","Input","onRequestConfirmation","action_1","Icon","HarnessControls","modes","draftTag","sentTag","HubStatus","statusLabel","additions","deletions","ChatWorkspaceHub","workspaceControl"],"sources":["../src/components/chat-ui/components/use-conversation-visibility.ts","../src/components/chat-ui/components/ai-conversation.tsx","../src/components/chat-ui/components/ai-message.tsx","../src/components/chat-ui/components/approval-prompt.tsx","../src/components/chat-ui/components/attachment-list.tsx","../src/components/chat-ui/components/auto-scroll.tsx","../src/theme/recipes/chat-composer.ts","../src/components/chat-ui/utils/editor-state.ts","../src/components/chat-ui/components/chat-input-actions.ts","../src/components/chat-ui/components/chat-input-attachments.ts","../src/components/chat-ui/components/send-button.tsx","../src/components/chat-ui/components/chat-input-toolbar.tsx","../src/components/chat-ui/components/composer-decision.ts","../src/components/chat-ui/components/question-choices.ts","../src/components/chat-ui/components/chat-input-question-answers.ts","../src/components/chat-ui/components/chat-input-question-step-tab.tsx","../src/components/chat-ui/tool-rendering/question-prompt.ts","../src/components/chat-ui/components/chat-question-navigation.tsx","../src/components/chat-ui/components/timeline-tool-blocks.tsx","../src/components/chat-ui/components/chat-input-question-prompt.tsx","../src/components/chat-ui/components/use-question-prompt-state.ts","../src/components/chat-ui/components/chat-input-question-form.tsx","../src/components/chat-ui/components/composer-decision-toolbar.tsx","../src/components/chat-ui/components/composer-takeover.tsx","../src/components/chat-ui/components/use-chat-input-focus.ts","../src/components/chat-ui/components/chat-input-history.ts","../src/components/chat-ui/components/use-chat-input-history.ts","../src/components/chat-ui/components/use-chat-input-text.ts","../src/components/chat-ui/components/composer-request.ts","../src/components/chat-ui/components/use-composer-request.ts","../src/components/chat-ui/components/chat-input.tsx","../src/components/chat-ui/components/chat-message-animation.ts","../src/components/chat-ui/components/message-action-panel.tsx","../src/components/chat-ui/components/ai-response.tsx","../src/components/chat-ui/components/chat-question-bubble.tsx","../src/components/chat-ui/utils/tool-name.ts","../src/components/chat-ui/utils/get-icon.ts","../src/components/chat-ui/utils/diff.ts","../src/components/chat-ui/tool-rendering/shared.ts","../src/components/chat-ui/tool-rendering/apply-patch-renderer.ts","../src/components/chat-ui/tool-rendering/edit-renderer.ts","../src/components/chat-ui/tool-rendering/question-renderer.ts","../src/components/chat-ui/tool-rendering/standard-renderers.ts","../src/components/chat-ui/tool-rendering/todowrite-renderer.ts","../src/components/chat-ui/tool-rendering/default-renderers.ts","../src/components/chat-ui/tool-rendering/build-timeline.ts","../src/components/diff-viewer/lazy-diff-editor.tsx","../src/components/chat-ui/components/timeline-indicator.tsx","../src/components/chat-ui/components/timeline-title.tsx","../src/components/chat-ui/components/timeline.tsx","../src/components/chat-ui/components/tool-invocation-timeline.tsx","../src/components/chat-ui/components/message-parts-renderer.tsx","../src/components/chat-ui/components/message-types.ts","../src/components/chat-ui/components/chat-message-list-items.tsx","../src/components/chat-ui/components/chat-message-rows.ts","../src/components/chat-ui/components/chat-panel-sticky-user-message.ts","../src/components/chat-ui/components/sticky-user-message.tsx","../src/components/chat-ui/components/use-chat-tail-ready.ts","../src/components/chat-ui/components/chat-message-list.tsx","../src/components/chat-ui/components/use-queued-follow-up-composer.ts","../src/components/chat-ui/components/queued-composer-input.tsx","../src/components/chat-ui/components/queued-follow-up-drag.tsx","../src/components/chat-ui/components/queued-follow-up-row.tsx","../src/components/chat-ui/components/queued-follow-up-list.tsx","../src/components/chat-ui/components/chat-panel-composer.tsx","../src/components/chat-ui/components/working-indicator.tsx","../src/components/chat-ui/components/chat-panel.tsx","../src/components/chat-ui/components/chat-skeleton.tsx","../src/components/chat-ui/components/conversation-browse.tsx","../src/components/chat-ui/components/harness-controls.tsx","../src/components/chat-ui/components/workspace-hub.tsx"],"sourcesContent":["import { useLayoutEffect } from \"react\";\nimport { useStickToBottomContext } from \"use-stick-to-bottom\";\n\n// Temporary library limitation: documentation/adrs/0075-temporary-hidden-conversation-scroll-restoration.md.\nexport const useConversationVisibility = () => {\n const { scrollRef, stopScroll, scrollToBottom } = useStickToBottomContext();\n useLayoutEffect(() => {\n const viewport = scrollRef.current;\n if (!viewport) return;\n let hidden = false;\n let position = { top: viewport.scrollTop, atTail: true };\n let frame = 0;\n const rememberPosition = () => {\n if (hidden || viewport.getClientRects().length === 0) return;\n position = {\n top: viewport.scrollTop,\n atTail: viewport.scrollHeight - viewport.clientHeight - viewport.scrollTop < 3,\n };\n };\n const observer = new ResizeObserver(() => {\n const isHidden = viewport.getClientRects().length === 0;\n if (isHidden) {\n hidden = true;\n stopScroll();\n } else if (hidden) {\n hidden = false;\n const saved = position;\n stopScroll();\n viewport.scrollTop = saved.top;\n frame = requestAnimationFrame(() => {\n if (saved.atTail) void scrollToBottom(\"instant\");\n else viewport.scrollTop = saved.top;\n });\n }\n });\n viewport.addEventListener(\"scroll\", rememberPosition);\n observer.observe(viewport);\n return () => {\n cancelAnimationFrame(frame);\n observer.disconnect();\n viewport.removeEventListener(\"scroll\", rememberPosition);\n };\n }, [scrollRef, stopScroll, scrollToBottom]);\n};\n","import type { HTMLChakraProps, IconButtonProps } from \"@chakra-ui/react\";\nimport { AbsoluteCenter, chakra, IconButton } from \"@chakra-ui/react\";\nimport { ArrowDownIcon } from \"lucide-react\";\nimport { StickToBottom as StickToBottomEl, useStickToBottomContext } from \"use-stick-to-bottom\";\nimport { ScrollArea } from \"@/components/primitives/scroll-area\";\nimport { useConversationVisibility } from \"./use-conversation-visibility\";\n\nexport type ConversationRootProps = HTMLChakraProps<\"div\", React.ComponentProps<typeof StickToBottomEl>>;\n\nexport const conversationRootDefaultProps = {\n \"aria-roledescription\": \"conversation\",\n initial: \"instant\",\n resize: \"instant\",\n role: \"log\",\n} as const;\n\nexport const ConversationRoot = chakra(\n StickToBottomEl,\n {\n base: {\n position: \"relative\",\n flex: 1,\n overflow: \"hidden\",\n height: \"full\",\n },\n },\n {\n forwardProps: [\"initial\", \"resize\"],\n defaultProps: conversationRootDefaultProps,\n },\n);\n\nexport type ConversationContentProps = Omit<React.ComponentProps<typeof ScrollArea>, \"contentProps\" | \"viewportRef\">;\n\nexport const ConversationContent = (props: ConversationContentProps) => {\n const { children, ...rest } = props;\n const { contentRef, scrollRef } = useStickToBottomContext();\n useConversationVisibility();\n\n return (\n <ScrollArea\n {...rest}\n height=\"full\"\n width=\"full\"\n showHorizontalScrollbar={false}\n viewportRef={scrollRef as React.Ref<HTMLDivElement>}\n contentRef={contentRef as React.Ref<HTMLDivElement>}\n verticalScrollbarProps={{ zIndex: 2 }}\n contentProps={{\n layerStyle: \"chatContent\",\n py: \"sm\",\n \"aria-live\": \"polite\",\n role: \"list\",\n }}\n >\n {children}\n </ScrollArea>\n );\n};\n\nexport type ConversationScrollButtonProps = IconButtonProps;\n\nexport const conversationScrollButtonContainerDefaultProps = {\n axis: \"horizontal\",\n bottom: \"md\",\n zIndex: 2,\n} as const;\n\nexport const ConversationScrollButton = (props: ConversationScrollButtonProps) => {\n const { isAtBottom, scrollToBottom } = useStickToBottomContext();\n\n return (\n !isAtBottom && (\n <AbsoluteCenter {...conversationScrollButtonContainerDefaultProps}>\n <IconButton rounded=\"full\" onClick={() => scrollToBottom()} variant=\"outline\" size=\"xs\" {...props}>\n <ArrowDownIcon size={16} />\n </IconButton>\n </AbsoluteCenter>\n )\n );\n};\n\nexport const ChatPrimitives = {\n Root: ConversationRoot,\n Viewport: ConversationContent,\n ScrollToBottom: ConversationScrollButton,\n} as const;\n","import type { HTMLChakraProps, RecipeVariantProps } from \"@chakra-ui/react\";\nimport { createSlotRecipeContext, defineSlotRecipe } from \"@chakra-ui/react\";\n\nconst recipe = defineSlotRecipe({\n className: \"ai-message\",\n slots: [\"root\", \"content\"],\n base: {\n root: {\n display: \"flex\",\n width: \"full\",\n alignItems: \"end\",\n justifyContent: \"end\",\n gap: \"sm\",\n \"&:has(+ [data-scope='ai-message'][data-part='root'])\": {\n mb: 0,\n },\n },\n content: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"sm\",\n textStyle: \"sm\",\n overflow: \"hidden\",\n borderRadius: \"0\",\n },\n },\n variants: {\n from: {\n user: {\n root: {\n mb: \"md\",\n flexDirection: \"row\",\n },\n content: {\n \"--chat-message-bg\": \"{colors.bg.subtle}\",\n bg: \"var(--chat-message-bg)\",\n px: \"xs\",\n py: \"xs\",\n width: \"full\",\n borderRadius: \"0\",\n },\n },\n assistant: {\n root: {\n mb: \"md\",\n flexDirection: \"row\",\n justifyContent: \"start\",\n },\n content: {\n width: \"full\",\n px: \"xs\",\n },\n },\n developer: {\n root: {\n width: \"full\",\n flexDirection: \"row-reverse\",\n },\n content: {\n width: \"full\",\n },\n },\n },\n size: {\n sm: {\n root: { gap: \"xs\" },\n content: { textStyle: \"xs\" },\n },\n md: {},\n lg: {\n root: { gap: \"md\" },\n content: { textStyle: \"md\" },\n },\n },\n // A message that could not be sent is dimmed until it is resent or removed.\n delivery: {\n sent: {},\n unsent: { content: { opacity: 0.6 } },\n },\n shape: {\n rounded: {\n content: { rounded: \"0\" },\n },\n pill: {\n content: { rounded: \"0\" },\n },\n square: {\n content: { rounded: \"0\" },\n },\n },\n },\n defaultVariants: {\n from: \"user\",\n size: \"md\",\n shape: \"rounded\",\n delivery: \"sent\",\n },\n});\n\nconst { withProvider, withContext } = createSlotRecipeContext({ recipe });\n\ntype VariantProps = RecipeVariantProps<typeof recipe>;\n\nexport interface MessageRootProps extends HTMLChakraProps<\"div\">, VariantProps {}\nexport const MessageRoot = withProvider<HTMLDivElement, MessageRootProps>(\"div\", \"root\");\n\nexport interface MessageContentProps extends HTMLChakraProps<\"div\">, VariantProps {}\nexport const MessageContent = withContext<HTMLDivElement, MessageContentProps>(\"div\", \"content\");\n\nexport const ChatMessage = {\n Root: MessageRoot,\n Content: MessageContent,\n} as const;\n","import { Box, Button, Code, Flex, HStack, Text } from \"@chakra-ui/react\";\nimport { ShieldCheck, ShieldX } from \"lucide-react\";\nimport { ScrollArea } from \"@/components/primitives/scroll-area\";\n\ninterface ApprovalPromptProps {\n toolName: string;\n toolInput?: unknown;\n onApprove: () => void;\n onDeny: () => void;\n}\n\nconst formatToolInput = (input: unknown) => {\n if (input == null) return null;\n\n const text = typeof input === \"string\" ? input : JSON.stringify(input, null, 2);\n if (text.length === 0) return null;\n\n const truncated = text.length > 200 ? `${text.slice(0, 200)}...` : text;\n return truncated;\n};\n\nexport const ApprovalPrompt = (props: ApprovalPromptProps) => {\n const { toolName, toolInput, onApprove, onDeny } = props;\n const formattedInput = formatToolInput(toolInput);\n\n return (\n <Box px=\"sm\" py=\"xs\" mx=\"sm\" borderWidth=\"1px\" borderColor=\"border.warning\" borderRadius=\"lg\" bg=\"bg.warning\">\n <Flex direction=\"column\" gap=\"xs\">\n <Text textStyle=\"label/S/medium\" color=\"fg\">\n Allow <Code size=\"sm\">{toolName}</Code>?\n </Text>\n\n {formattedInput ? (\n <ScrollArea maxH=\"6rem\">\n <Code size=\"sm\" whiteSpace=\"pre-wrap\" display=\"block\" width=\"100%\">\n {formattedInput}\n </Code>\n </ScrollArea>\n ) : null}\n\n <HStack gap=\"xs\" justifyContent=\"flex-end\">\n <Button size=\"xs\" variant=\"outline\" onClick={onDeny}>\n <ShieldX size={14} />\n Deny\n </Button>\n <Button size=\"xs\" colorPalette=\"green\" onClick={onApprove}>\n <ShieldCheck size={14} />\n Allow\n </Button>\n </HStack>\n </Flex>\n </Box>\n );\n};\n","import { Stack } from \"@chakra-ui/react\";\nimport type { ReactNode } from \"react\";\nimport { Fragment } from \"react\";\nimport type { ResourceBadgeProps } from \"@/components/primitives/resource-badge\";\nimport { ResourceBadge } from \"@/components/primitives/resource-badge\";\n\nexport type AttachmentListRenderBadge = (props: AttachmentListItemRenderProps) => ReactNode;\n\nexport interface AttachmentListItemRenderProps {\n attachmentId: string;\n onSelect?: () => void;\n onRemove?: () => void;\n size: ResourceBadgeProps[\"size\"];\n tone: ResourceBadgeProps[\"tone\"];\n}\n\nexport interface AttachmentListProps {\n attachments?: string[];\n onSelect?: (attachmentId: string) => void;\n onRemove?: (attachmentId: string) => void;\n renderBadge?: AttachmentListRenderBadge;\n size?: ResourceBadgeProps[\"size\"];\n tone?: ResourceBadgeProps[\"tone\"];\n}\n\nconst DEFAULT_SIZE: NonNullable<ResourceBadgeProps[\"size\"]> = \"md\";\nconst DEFAULT_TONE: NonNullable<ResourceBadgeProps[\"tone\"]> = \"neutral\";\n\n/**\n * Simple attachment list component that displays resource badges.\n *\n */\nexport const AttachmentList = (props: AttachmentListProps) => {\n const { attachments = [], onSelect, onRemove, renderBadge, size = DEFAULT_SIZE, tone = DEFAULT_TONE } = props;\n\n if (attachments.length === 0) return null;\n\n return (\n <Stack marginBottom=\"sm\" gap=\"1\" flexDir=\"row\" flexWrap=\"wrap\">\n {attachments.map((attachment) => {\n const select = onSelect ? () => onSelect(attachment) : undefined;\n const remove = onRemove ? () => onRemove(attachment) : undefined;\n\n if (renderBadge) {\n const rendered = renderBadge({ attachmentId: attachment, onSelect: select, onRemove: remove, size, tone });\n return <Fragment key={attachment}>{rendered}</Fragment>;\n }\n\n return (\n <ResourceBadge\n key={attachment}\n fileName={attachment}\n onSelect={select}\n onRemove={remove}\n size={size}\n tone={tone}\n />\n );\n })}\n </Stack>\n );\n};\n","import { useEffect, useRef } from \"react\";\nimport { useStickToBottomContext } from \"use-stick-to-bottom\";\n\nexport interface AutoScrollProps {\n userMessageCount: number;\n conversationKey?: string | null;\n}\n\ninterface ShouldAutoScrollArgs {\n previousUserMessageCount: number;\n userMessageCount: number;\n}\n\nexport interface AutoScrollState {\n conversationKey: string | null;\n userMessageCount: number;\n}\n\ninterface NextAutoScrollStateArgs {\n state: AutoScrollState;\n conversationKey?: string | null;\n userMessageCount: number;\n}\n\ninterface ScrollForNextAutoScrollStateArgs extends NextAutoScrollStateArgs {\n scrollToBottom: (animation?: \"instant\") => void;\n}\n\nexport const shouldAutoScroll = (args: ShouldAutoScrollArgs) => {\n const { previousUserMessageCount, userMessageCount } = args;\n\n if (previousUserMessageCount === 0) {\n return false;\n }\n\n return userMessageCount > previousUserMessageCount;\n};\n\nexport const getNextAutoScrollState = (args: NextAutoScrollStateArgs) => {\n const conversationKey = args.conversationKey ?? null;\n\n if (args.state.conversationKey !== conversationKey) {\n return {\n shouldScroll: false,\n state: {\n conversationKey,\n userMessageCount: args.userMessageCount,\n },\n };\n }\n\n return {\n shouldScroll: shouldAutoScroll({\n previousUserMessageCount: args.state.userMessageCount,\n userMessageCount: args.userMessageCount,\n }),\n state: {\n conversationKey,\n userMessageCount: Math.max(args.state.userMessageCount, args.userMessageCount),\n },\n };\n};\n\nexport const scrollForNextAutoScrollState = (args: ScrollForNextAutoScrollStateArgs) => {\n const next = getNextAutoScrollState(args);\n\n if (next.shouldScroll) {\n args.scrollToBottom(\"instant\");\n }\n\n return next;\n};\n\nexport function AutoScroll(props: AutoScrollProps) {\n const { conversationKey, userMessageCount } = props;\n const { scrollToBottom } = useStickToBottomContext();\n const stateRef = useRef<AutoScrollState>({\n conversationKey: conversationKey ?? null,\n userMessageCount,\n });\n\n useEffect(() => {\n const next = scrollForNextAutoScrollState({\n state: stateRef.current,\n conversationKey,\n userMessageCount,\n scrollToBottom,\n });\n\n stateRef.current = next.state;\n }, [conversationKey, userMessageCount, scrollToBottom]);\n\n return null;\n}\n","import { defineSlotRecipe } from \"@chakra-ui/react\";\n\nexport const chatComposerRecipe = defineSlotRecipe({\n className: \"ps-chat-composer\",\n slots: [\"input\", \"workspace\"],\n base: {\n input: {\n position: \"relative\",\n width: \"full\",\n padding: \"xs\",\n bg: \"bg\",\n borderRadius: \"xs\",\n _focusWithin: { outline: \"{borders.accent-light}\", outlineOffset: \"-1px\" },\n },\n workspace: { display: \"flex\", flexDirection: \"column\", gap: \"0\" },\n },\n variants: {\n attachedToTop: {\n true: { input: { borderTopRadius: \"0\" } },\n },\n workspace: {\n true: {\n workspace: {\n padding: \"2xs\",\n borderRadius: \"xs\",\n bg: \"bg.muted\",\n },\n },\n },\n },\n});\n","import { generateEditorStateFromString } from \"../../rich-text\";\n\nexport const createSerializedPromptState = (input = \"\") => {\n return JSON.stringify(generateEditorStateFromString(input));\n};\n","interface ChatInputActionState {\n canInterrupt: boolean;\n /** False while the runtime cannot accept a message, for example without a model. */\n canSubmit: boolean;\n hasQuestionPrompt: boolean;\n isDisabled: boolean;\n streaming: boolean;\n text: string;\n}\n\nexport type ChatInputAction = \"interrupt\" | \"none\" | \"submit\";\n\nconst hasMessageText = (text: string) => text.trim().length > 0;\n\nexport const resolveChatInputKeyboardAction = (state: ChatInputActionState): ChatInputAction => {\n const { canSubmit, isDisabled, text } = state;\n if (isDisabled || !canSubmit || !hasMessageText(text)) return \"none\";\n return \"submit\";\n};\n\nexport const resolveChatInputButtonAction = (state: ChatInputActionState): ChatInputAction => {\n const { canInterrupt, canSubmit, hasQuestionPrompt, isDisabled, streaming, text } = state;\n if (isDisabled) return \"none\";\n if (canSubmit && hasMessageText(text)) return \"submit\";\n if (streaming && !hasQuestionPrompt) return canInterrupt ? \"interrupt\" : \"none\";\n return \"none\";\n};\n","import type { ClipboardEvent, DragEvent } from \"react\";\n\nexport const DEFAULT_TEXT_ATTACHMENT_PASTE_LINE_THRESHOLD = 200;\n\nexport const shouldAttachPastedText = (text: string, lineThreshold = DEFAULT_TEXT_ATTACHMENT_PASTE_LINE_THRESHOLD) =>\n text.length > 0 && text.split(/\\r\\n|\\r|\\n/).length > lineThreshold;\n\nexport const createAttachmentEventHandlers = (input: {\n onAttachFiles?: (files: File[]) => void;\n onAttachText?: (text: string) => void;\n textAttachmentPasteLineThreshold: number;\n}) => {\n const { onAttachFiles, onAttachText, textAttachmentPasteLineThreshold } = input;\n\n const onPasteCapture = (event: ClipboardEvent<HTMLDivElement>) => {\n const files = Array.from(event.clipboardData.files ?? []);\n if (files.length > 0 && onAttachFiles) {\n event.preventDefault();\n onAttachFiles(files);\n return;\n }\n\n const pastedText = event.clipboardData.getData(\"text/plain\");\n if (onAttachText && shouldAttachPastedText(pastedText, textAttachmentPasteLineThreshold)) {\n event.preventDefault();\n onAttachText(pastedText);\n }\n };\n\n const onDropCapture = (event: DragEvent<HTMLDivElement>) => {\n const files = Array.from(event.dataTransfer.files ?? []);\n if (files.length === 0 || !onAttachFiles) return;\n\n event.preventDefault();\n onAttachFiles(files);\n };\n\n const onDragOver = (event: DragEvent<HTMLDivElement>) => {\n if (!onAttachFiles || !Array.from(event.dataTransfer.types).includes(\"Files\")) return;\n event.preventDefault();\n };\n\n return { onDragOver, onDropCapture, onPasteCapture };\n};\n","import { IconButton, type IconButtonProps, Kbd, Portal, Tooltip } from \"@chakra-ui/react\";\nimport { ArrowUp, Pause } from \"lucide-react\";\n\nexport interface SendButtonProps extends IconButtonProps {\n shortcut?: string;\n title?: string;\n canInterrupt: boolean;\n}\n\nexport const SendButton = (props: SendButtonProps) => {\n const { title, shortcut, canInterrupt, ...rest } = props;\n const ariaLabel = rest[\"aria-label\"] ?? title;\n\n const icon = canInterrupt ? (\n <Pause size={16} strokeWidth={2} fill=\"currentColor\" />\n ) : (\n <ArrowUp size={16} strokeWidth={2} />\n );\n\n const button = (\n <IconButton\n data-testid=\"send-message-button\"\n size=\"xs\"\n variant=\"primary\"\n aria-label={ariaLabel}\n title={title}\n {...rest}\n >\n {icon}\n </IconButton>\n );\n\n if (title) {\n const tooltipContent = shortcut ? (\n <>\n {title} <Kbd fontSize=\"xs\">{shortcut}</Kbd>\n </>\n ) : (\n title\n );\n\n return (\n <Tooltip.Root closeDelay={50} openDelay={100}>\n <Tooltip.Trigger asChild>{button}</Tooltip.Trigger>\n <Portal>\n <Tooltip.Positioner>\n <Tooltip.Content>{tooltipContent}</Tooltip.Content>\n </Tooltip.Positioner>\n </Portal>\n </Tooltip.Root>\n );\n }\n\n return button;\n};\n","import { Button, HStack } from \"@chakra-ui/react\";\nimport type { ReactNode } from \"react\";\nimport { ScrollArea } from \"@/components/primitives/scroll-area\";\nimport type { ChatInputAction } from \"./chat-input-actions\";\nimport { COMPOSER_CONTROL_HEIGHT } from \"./composer-constants\";\nimport { SendButton } from \"./send-button\";\n\ninterface ChatInputToolbarProps {\n actions?: ReactNode;\n submitActions?: ReactNode;\n questionPrompt: boolean;\n skipDisabled: boolean;\n skipTitle: string;\n onSkip: () => void;\n buttonAction: ChatInputAction;\n submitTitle?: string;\n submitLabel?: string;\n messageTitle: string;\n runAction: (action: ChatInputAction) => void;\n}\nexport const ChatInputToolbar = (props: ChatInputToolbarProps) => {\n const {\n actions,\n submitActions,\n questionPrompt,\n skipDisabled,\n skipTitle,\n onSkip,\n buttonAction,\n submitTitle,\n submitLabel,\n messageTitle,\n runAction,\n } = props;\n return (\n <HStack gap=\"1\" minH={COMPOSER_CONTROL_HEIGHT} align=\"center\">\n <ScrollArea flex=\"1\" minW=\"0\" showVerticalScrollbar={false} showHorizontalScrollbar>\n <HStack gap=\"1\" width=\"max-content\" minH={COMPOSER_CONTROL_HEIGHT}>\n {actions}\n </HStack>\n </ScrollArea>\n {submitActions}\n {questionPrompt ? (\n <Button size=\"xs\" variant=\"ghost\" disabled={skipDisabled} title={skipTitle} onClick={onSkip}>\n Skip\n </Button>\n ) : null}\n {submitLabel ? (\n <Button size=\"xs\" variant=\"primary\" disabled={buttonAction === \"none\"} onClick={() => runAction(buttonAction)}>\n {submitLabel}\n </Button>\n ) : (\n <SendButton\n canInterrupt={buttonAction === \"interrupt\"}\n title={buttonAction === \"interrupt\" ? \"Stop Response\" : (submitTitle ?? messageTitle)}\n shortcut={buttonAction === \"submit\" ? \"Enter\" : undefined}\n onClick={() => runAction(buttonAction)}\n disabled={buttonAction === \"none\"}\n />\n )}\n </HStack>\n );\n};\n","import type { ReactNode } from \"react\";\nimport type { ChatInputQuestionResponse } from \"./chat-input-question-prompt\";\n\n/** A native decision occupies the composer without submitting the saved draft. */\nexport interface ComposerDecision {\n id: string;\n controls?: ReactNode;\n model?: string;\n pending?: boolean;\n actions: { id: string; label: string; variant: \"primary\" | \"subtle\" | \"ghost\"; disabled?: boolean }[];\n onAction: (actionId: string) => void | Promise<void>;\n}\n\ninterface ComposerResponseInput {\n response?: ChatInputQuestionResponse;\n text: string;\n attachments: string[];\n onSubmit: (text: string, attachments: string[], response?: ChatInputQuestionResponse) => void | Promise<void>;\n onClearAttachments?: () => void;\n}\n\nexport const submitComposerResponse = async (input: ComposerResponseInput) => {\n await input.onSubmit(input.text, input.response ? [] : input.attachments, input.response);\n if (!input.response) input.onClearAttachments?.();\n};\n","/** The \"Other\" choice shared by the question form and the helpers that read its answers. */\nexport const OTHER_CHOICE_LABEL = \"Other\";\n\n/**\n * The value the choice group carries while \"Other\" is picked. It never leaves the form: the typed\n * text is the answer. Listed choices use positional values, so agent labels cannot collide with it.\n */\nexport const OTHER_CHOICE_VALUE = \"__pstdio_other__\";\n\n// Question ids come from agents and may match inherited object properties.\nexport const getOwnQuestionValue = <T>(values: Record<string, T>, key: string) =>\n Object.hasOwn(values, key) ? values[key] : undefined;\n\n/**\n * A question with options offers its free text as an \"Other\" choice. A question with no options is\n * free text from the start, so its field is always open and there is nothing to be other than.\n */\nexport const questionOffersOtherChoice = (question: { options: unknown[]; allowCustomAnswer?: boolean }) =>\n Boolean(question.allowCustomAnswer) && question.options.length > 0;\n","import { getOwnQuestionValue } from \"./question-choices\";\n\nexport interface ChatInputQuestionOption {\n label: string;\n description?: string;\n}\n\nexport interface ChatInputQuestion {\n id?: string;\n question: string;\n options: ChatInputQuestionOption[];\n multiple?: boolean;\n required?: boolean;\n allowCustomAnswer?: boolean;\n}\n\nexport interface ChatInputQuestionPrompt {\n questions: ChatInputQuestion[];\n callId?: string;\n /** Async requests open from their chat bubble and preselect their first offered options. */\n delivery?: \"async\";\n}\n\nexport interface ChatInputQuestionResponse {\n answers: string[][];\n callId?: string;\n}\n\nexport type ChatInputQuestionCustomAnswers = Record<string, string>;\n\nexport const getQuestionSelectionKey = (question: ChatInputQuestion, index: number) =>\n question.id ?? `question-${index}`;\n\n// \"Other\" is chosen exactly when the question holds a custom answer, empty or not. That keeps\n// the choice and its text in one place instead of a second map that can disagree with it.\nexport const isQuestionOtherSelected = (\n customAnswersByQuestion: ChatInputQuestionCustomAnswers,\n question: ChatInputQuestion,\n questionIndex: number,\n // Question ids come from the agent, so `in` would match inherited keys such as \"constructor\".\n) => Object.hasOwn(customAnswersByQuestion, getQuestionSelectionKey(question, questionIndex));\n\nexport const clearQuestionOtherAnswer = (\n customAnswersByQuestion: ChatInputQuestionCustomAnswers,\n question: ChatInputQuestion,\n questionIndex: number,\n) => {\n const { [getQuestionSelectionKey(question, questionIndex)]: _removed, ...rest } = customAnswersByQuestion;\n return rest;\n};\n\nexport const toggleQuestionOtherAnswer = (\n customAnswersByQuestion: ChatInputQuestionCustomAnswers,\n question: ChatInputQuestion,\n questionIndex: number,\n) => {\n if (isQuestionOtherSelected(customAnswersByQuestion, question, questionIndex)) {\n return clearQuestionOtherAnswer(customAnswersByQuestion, question, questionIndex);\n }\n return { ...customAnswersByQuestion, [getQuestionSelectionKey(question, questionIndex)]: \"\" };\n};\n\n/** Shown in the chat so the transcript records that the person chose not to answer. */\nexport const SKIPPED_QUESTION_TEXT = \"Skipped the question.\";\n\n// The call id names the live request the prompt came from, so a reply can never reach a newer\n// request that asks the same question.\nexport const toQuestionResponse = (\n questionPrompt: ChatInputQuestionPrompt,\n answers: string[][],\n): ChatInputQuestionResponse => (questionPrompt.callId ? { answers, callId: questionPrompt.callId } : { answers });\n\n/** A skipped question carries no entry at all, which no answered form ever produces. */\nexport const buildSkippedQuestionResponse = (questionPrompt: ChatInputQuestionPrompt) =>\n toQuestionResponse(questionPrompt, []);\n\n// Single-choice questions swap the answer; multiple-choice questions toggle one option.\nexport const toggleQuestionOptionSelection = (\n selectedOptionsByQuestion: Record<string, string[]>,\n question: ChatInputQuestion,\n questionIndex: number,\n optionLabel: string,\n) => {\n const key = getQuestionSelectionKey(question, questionIndex);\n const selected = getOwnQuestionValue(selectedOptionsByQuestion, key) ?? [];\n const alreadySelected = selected.includes(optionLabel);\n if (question.multiple) {\n return {\n ...selectedOptionsByQuestion,\n [key]: alreadySelected ? selected.filter((label) => label !== optionLabel) : [...selected, optionLabel],\n };\n }\n return { ...selectedOptionsByQuestion, [key]: alreadySelected ? [] : [optionLabel] };\n};\n\nexport const getQuestionPromptSignature = (questionPrompt: ChatInputQuestionPrompt | undefined) => {\n if (!questionPrompt) return \"\";\n\n return JSON.stringify({\n callId: questionPrompt.callId,\n delivery: questionPrompt.delivery,\n questions: questionPrompt.questions.map((question, index) => ({\n id: getQuestionSelectionKey(question, index),\n question: question.question,\n multiple: Boolean(question.multiple),\n required: Boolean(question.required),\n allowCustomAnswer: Boolean(question.allowCustomAnswer),\n options: question.options.map((option) => ({\n label: option.label,\n description: option.description ?? \"\",\n })),\n })),\n });\n};\n\n// A single-choice question answers with one value: the typed text replaces the listed option it\n// was chosen instead of. A multiple-choice question keeps the typed text beside its checked boxes.\nexport const answersForQuestion = (\n question: ChatInputQuestion,\n selectedLabels: string[],\n customAnswer: string | undefined,\n) => {\n const typed = customAnswer?.trim();\n if (!typed) return selectedLabels;\n return question.multiple ? [...selectedLabels, typed] : [typed];\n};\n\nexport const getAnswersForQuestion = (\n question: ChatInputQuestion,\n key: string,\n selectedOptionsByQuestion: Record<string, string[]>,\n customAnswersByQuestion: ChatInputQuestionCustomAnswers,\n) =>\n answersForQuestion(\n question,\n getOwnQuestionValue(selectedOptionsByQuestion, key) ?? [],\n getOwnQuestionValue(customAnswersByQuestion, key),\n );\n\nconst getQuestionAnswerLines = (\n questionPrompt: ChatInputQuestionPrompt,\n selectedOptionsByQuestion: Record<string, string[]>,\n customAnswersByQuestion: ChatInputQuestionCustomAnswers,\n) => {\n const lines: string[] = [];\n\n for (let index = 0; index < questionPrompt.questions.length; index += 1) {\n const question = questionPrompt.questions[index];\n const key = getQuestionSelectionKey(question, index);\n const answers = getAnswersForQuestion(question, key, selectedOptionsByQuestion, customAnswersByQuestion);\n if (answers.length === 0) continue;\n\n lines.push(`${question.question}: ${answers.join(\", \")}`);\n }\n\n return lines;\n};\n\nconst isCustomAnswersByQuestion = (\n value: ChatInputQuestionCustomAnswers | string,\n): value is ChatInputQuestionCustomAnswers => typeof value !== \"string\";\n\nconst toCustomAnswersByQuestion = (\n questionPrompt: ChatInputQuestionPrompt,\n answerInput: ChatInputQuestionCustomAnswers | string,\n) => {\n if (isCustomAnswersByQuestion(answerInput)) return answerInput;\n\n const trimmed = answerInput.trim();\n if (trimmed.length === 0) return {};\n\n return Object.fromEntries(\n questionPrompt.questions.flatMap((question, index) =>\n question.allowCustomAnswer ? [[getQuestionSelectionKey(question, index), trimmed]] : [],\n ),\n );\n};\n\nexport const buildQuestionResponse = (\n questionPrompt: ChatInputQuestionPrompt | undefined,\n selectedOptionsByQuestion: Record<string, string[]>,\n answerInput: ChatInputQuestionCustomAnswers | string,\n) => {\n if (!questionPrompt) return typeof answerInput === \"string\" ? answerInput.trim() : \"\";\n\n const customAnswersByQuestion = toCustomAnswersByQuestion(questionPrompt, answerInput);\n const lines = getQuestionAnswerLines(questionPrompt, selectedOptionsByQuestion, customAnswersByQuestion);\n const legacyText = typeof answerInput === \"string\" ? answerInput.trim() : \"\";\n const hasCustomQuestions = questionPrompt.questions.some((question) => question.allowCustomAnswer);\n\n if (legacyText.length > 0 && !hasCustomQuestions) {\n lines.push(`Additional response: ${legacyText}`);\n }\n\n return lines.join(\"\\n\");\n};\n\nexport const buildQuestionAnswerValues = (\n questionPrompt: ChatInputQuestionPrompt,\n selectedOptionsByQuestion: Record<string, string[]>,\n answerInput: ChatInputQuestionCustomAnswers | string,\n) => {\n const customAnswersByQuestion = toCustomAnswersByQuestion(questionPrompt, answerInput);\n\n return questionPrompt.questions.map((question, index) => {\n const key = getQuestionSelectionKey(question, index);\n return getAnswersForQuestion(question, key, selectedOptionsByQuestion, customAnswersByQuestion);\n });\n};\n\nexport const hasMissingRequiredQuestionAnswer = (\n questionPrompt: ChatInputQuestionPrompt | undefined,\n selectedOptionsByQuestion: Record<string, string[]>,\n answerInput: ChatInputQuestionCustomAnswers | string,\n) => {\n if (!questionPrompt) return false;\n\n const customAnswersByQuestion = toCustomAnswersByQuestion(questionPrompt, answerInput);\n\n for (let index = 0; index < questionPrompt.questions.length; index += 1) {\n const question = questionPrompt.questions[index];\n if (!question.required) continue;\n\n const key = getQuestionSelectionKey(question, index);\n // One rule decides what a question answers with, so the send guard cannot drift from it.\n if (getAnswersForQuestion(question, key, selectedOptionsByQuestion, customAnswersByQuestion).length > 0) continue;\n\n return true;\n }\n\n return false;\n};\n","import { Button } from \"@chakra-ui/react\";\nimport { Check } from \"lucide-react\";\nimport { Tooltip } from \"@/components/primitives/tooltip\";\nimport {\n type ChatInputQuestion,\n type ChatInputQuestionCustomAnswers,\n getAnswersForQuestion,\n getQuestionSelectionKey,\n} from \"./chat-input-question-answers\";\n\ninterface QuestionStepTabProps {\n question: ChatInputQuestion;\n questionIndex: number;\n isActive: boolean;\n selectedOptionsByQuestion: Record<string, string[]>;\n customAnswersByQuestion: ChatInputQuestionCustomAnswers;\n onSelectStep: (questionIndex: number) => void;\n}\n\nconst hasQuestionAnswer = (\n question: ChatInputQuestion,\n questionIndex: number,\n selectedOptionsByQuestion: Record<string, string[]>,\n customAnswersByQuestion: ChatInputQuestionCustomAnswers,\n) => {\n const key = getQuestionSelectionKey(question, questionIndex);\n // The same rule the send guard uses, so a ticked step always matches what the form would send.\n return getAnswersForQuestion(question, key, selectedOptionsByQuestion, customAnswersByQuestion).length > 0;\n};\n\nexport const QuestionStepTab = (props: QuestionStepTabProps) => {\n const { question, questionIndex, isActive, selectedOptionsByQuestion, customAnswersByQuestion, onSelectStep } = props;\n const isAnswered = hasQuestionAnswer(question, questionIndex, selectedOptionsByQuestion, customAnswersByQuestion);\n const stepStateLabel = isAnswered ? \"answered\" : \"not answered\";\n const tabVariant = isActive ? \"outline\" : \"ghost\";\n\n return (\n <Tooltip content={question.question}>\n <Button\n id={`question-step-tab-${question.id}`}\n role=\"tab\"\n aria-label={`${question.question} (${stepStateLabel})`}\n aria-selected={isActive}\n aria-controls={`question-step-panel-${question.id}`}\n size=\"xs\"\n variant={tabVariant}\n minW=\"8\"\n onClick={() => onSelectStep(questionIndex)}\n >\n {isAnswered ? <Check aria-hidden=\"true\" /> : questionIndex + 1}\n </Button>\n </Tooltip>\n );\n};\n","import type { SessionMessage, ToolPart } from \"../components/message-types\";\nimport type { QuestionFormBlockOption, QuestionFormBlockQuestion } from \"../components/timeline\";\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n};\n\nconst parseJsonObjectText = (value: string) => {\n try {\n const parsed: unknown = JSON.parse(value);\n return isRecord(parsed) ? parsed : null;\n } catch {\n return null;\n }\n};\n\nconst toInputRecord = (input: unknown) => {\n if (isRecord(input)) return input;\n if (typeof input === \"string\" && input.trim().length > 0) return parseJsonObjectText(input);\n return null;\n};\n\nconst getStringValue = (value: unknown) => {\n if (typeof value === \"string\" && value.trim().length > 0) return value;\n return null;\n};\n\nexport const getQuestionResponseText = (value: unknown): string | null => {\n const stringValue = getStringValue(value);\n if (stringValue) return stringValue;\n\n if (Array.isArray(value)) {\n const lines = value.map(getQuestionResponseText).filter((line): line is string => line !== null);\n return lines.length > 0 ? lines.join(\"\\n\") : null;\n }\n\n if (!isRecord(value)) return null;\n\n return (\n getQuestionResponseText(value.response) ??\n getQuestionResponseText(value.answer) ??\n getQuestionResponseText(value.text) ??\n getQuestionResponseText(value.answers)\n );\n};\n\nconst carriesAnswers = (value: unknown): boolean => {\n if (!isRecord(value)) return false;\n if (Array.isArray(value.answers)) return true;\n return carriesAnswers(value.response) || carriesAnswers(value.answer);\n};\n\n/**\n * Whether the person has responded at all. A skipped question answers with no values, so it has a\n * response payload but no response text; reading the text alone would leave the form open forever.\n */\nexport const hasQuestionResponse = (value: unknown) => getQuestionResponseText(value) !== null || carriesAnswers(value);\n\nconst parseQuestionOption = (value: unknown): QuestionFormBlockOption | null => {\n if (typeof value === \"string\" && value.trim().length > 0) {\n return { label: value, description: undefined };\n }\n\n if (!isRecord(value)) return null;\n const label = getStringValue(value.label);\n if (!label) return null;\n\n return {\n label,\n description: getStringValue(value.description) ?? undefined,\n };\n};\n\nconst parseQuestion = (value: unknown, index: number): QuestionFormBlockQuestion | null => {\n if (!isRecord(value)) return null;\n\n const question = getStringValue(value.question);\n if (!question) return null;\n\n const options = Array.isArray(value.options)\n ? value.options.map(parseQuestionOption).filter((option): option is QuestionFormBlockOption => option !== null)\n : [];\n const type = getStringValue(value.type);\n const declaredCustomAnswer =\n typeof value.allowCustomAnswer === \"boolean\"\n ? value.allowCustomAnswer\n : options.length === 0 || type === \"freeform\" || type === \"text\";\n const allowCustomAnswer = typeof value.custom === \"boolean\" ? value.custom : declaredCustomAnswer;\n\n return {\n id: getStringValue(value.id) ?? `question-${index}`,\n question,\n options,\n multiple:\n typeof value.multiple === \"boolean\" ? value.multiple : type === \"multi_choice\" || type === \"multiple_choice\",\n required: typeof value.required === \"boolean\" ? value.required : true,\n allowCustomAnswer,\n };\n};\n\nexport const parseQuestionPrompt = (input: unknown) => {\n const record = toInputRecord(input);\n if (!record || !Array.isArray(record.questions)) return null;\n\n const questions = record.questions.map(parseQuestion).filter((question): question is QuestionFormBlockQuestion => {\n return question !== null;\n });\n if (questions.length === 0) return null;\n\n return { questions, ...(record.delivery === \"async\" ? { delivery: \"async\" as const } : {}) };\n};\n\nconst isQuestionTool = (part: ToolPart) => part.tool.toLowerCase() === \"question\";\n\nconst orderedQuestionRequests = (messages: SessionMessage[]) => {\n // Map preserves arrival order while later snapshots replace native request state.\n const requests = new Map<string | ToolPart, ToolPart>();\n for (const message of messages) {\n if (message.role !== \"assistant\") continue;\n for (const part of message.parts) {\n if (part.type !== \"tool\" || !isQuestionTool(part)) continue;\n requests.set(part.callId ?? part, part);\n }\n }\n return requests.values();\n};\n\nexport const getQuestionRequestKey = (part: ToolPart) => part.callId ?? JSON.stringify(part.state?.input);\n\nexport const isPendingQuestion = (part: ToolPart) =>\n part.status !== \"failed\" &&\n part.status !== \"denied\" &&\n !hasQuestionResponse(part.state?.output) &&\n !hasQuestionResponse(part.state?.metadata);\n\nconst questionPromptFor = (part: ToolPart) => {\n if (!isPendingQuestion(part)) return undefined;\n const prompt = parseQuestionPrompt(part.state?.input);\n return prompt ? { ...prompt, ...(part.callId ? { callId: part.callId } : {}) } : undefined;\n};\n\nexport const resolveQuestionPrompt = (messages: SessionMessage[], key: string) => {\n const part = [...orderedQuestionRequests(messages)].find((part) => getQuestionRequestKey(part) === key);\n return part ? questionPromptFor(part) : undefined;\n};\n\nexport const resolveActiveQuestionPrompt = (messages: SessionMessage[]) => {\n for (const part of orderedQuestionRequests(messages)) {\n const prompt = questionPromptFor(part);\n if (prompt && prompt.delivery !== \"async\") return prompt;\n }\n return undefined;\n};\n\nexport const getQuestionBubbleAnswer = (part: ToolPart, index: number): string | undefined => {\n for (const value of [part.state?.metadata, part.state?.output]) {\n const record = toInputRecord(value);\n if (Array.isArray(record?.answers)) {\n const answers = record.answers[index];\n return Array.isArray(answers) && answers.length ? answers.join(\", \") : \"Skipped\";\n }\n }\n if (isPendingQuestion(part)) return undefined;\n const prompt = parseQuestionPrompt(part.state?.input);\n const text = getQuestionResponseText(part.state?.output);\n if (!text || !prompt) return part.status === \"failed\" || part.status === \"denied\" ? \"Unavailable\" : \"Answered\";\n const question = prompt.questions[index].question;\n const answer = text.split(/\\n\\n/).find((section) => section.startsWith(`${question}\\n`));\n if (answer) return answer.slice(question.length + 1).trim() || \"Skipped\";\n return prompt.questions.length === 1 ? text : \"Answered\";\n};\n","import { createContext, useContext, useState } from \"react\";\nimport { getQuestionRequestKey, resolveQuestionPrompt } from \"../tool-rendering/question-prompt\";\nimport type { SessionMessage, ToolPart } from \"./message-types\";\n\ninterface QuestionSelection {\n conversationKey?: string;\n key: string;\n index: number;\n revision: number;\n}\n\ninterface QuestionNavigation {\n activeKey?: string;\n selection?: QuestionSelection;\n open: (part: ToolPart, index: number) => void;\n selectStep: (index: number) => void;\n close: () => void;\n}\n\nexport const ChatQuestionNavigationContext = createContext<QuestionNavigation | undefined>(undefined);\nexport const useQuestionNavigation = () => useContext(ChatQuestionNavigationContext);\n\nexport const useChatQuestionNavigation = (messages: SessionMessage[], conversationKey?: string) => {\n const [selection, setSelection] = useState<QuestionSelection>();\n const current = selection?.conversationKey === conversationKey ? selection : undefined;\n const prompt = current ? resolveQuestionPrompt(messages, current.key) : undefined;\n return {\n prompt,\n value: {\n activeKey: prompt ? current?.key : undefined,\n selection: prompt ? current : undefined,\n open: (part: ToolPart, index: number) =>\n setSelection((previous) => ({\n conversationKey,\n key: getQuestionRequestKey(part),\n index,\n revision: (previous?.revision ?? 0) + 1,\n })),\n selectStep: (index) => setSelection((previous) => (previous ? { ...previous, index } : undefined)),\n close: () => setSelection(undefined),\n } satisfies QuestionNavigation,\n };\n};\n","import { Box, Stack, Text, Textarea } from \"@chakra-ui/react\";\nimport type { FormEvent, ReactNode } from \"react\";\nimport { Checkbox } from \"@/components/primitives/checkbox\";\nimport { Radio, RadioGroup } from \"@/components/primitives/radio\";\nimport {\n getOwnQuestionValue,\n OTHER_CHOICE_LABEL,\n OTHER_CHOICE_VALUE,\n questionOffersOtherChoice,\n} from \"./question-choices\";\nimport type { QuestionFormBlockQuestion, TodoListBlockItem } from \"./timeline\";\n\nconst preventSubmit = (event: FormEvent) => {\n event.preventDefault();\n};\n\ninterface QuestionFormBlockViewProps {\n questions: QuestionFormBlockQuestion[];\n editable?: boolean;\n selectedOptionsByQuestion?: Record<string, string[]>;\n customAnswersByQuestion?: Record<string, string>;\n onToggleOption?: (question: QuestionFormBlockQuestion, questionIndex: number, optionLabel: string) => void;\n onToggleOther?: (question: QuestionFormBlockQuestion, questionIndex: number) => void;\n onCustomAnswerChange?: (question: QuestionFormBlockQuestion, questionIndex: number, answer: string) => void;\n}\n\nconst QuestionOptionContent = (props: { option: QuestionFormBlockQuestion[\"options\"][number] }) => {\n const { option } = props;\n\n return (\n <Stack gap=\"0\" minWidth=\"0\">\n <Text textStyle=\"label/S/regular\" color=\"fg\">\n {option.label}\n </Text>\n {option.description ? (\n <Text textStyle=\"label/XS/regular\" color=\"fg.muted\">\n {option.description}\n </Text>\n ) : null}\n </Stack>\n );\n};\n\nconst QuestionCheckboxOptionRow = (props: {\n option: QuestionFormBlockQuestion[\"options\"][number];\n name: string;\n checked: boolean;\n editable: boolean;\n onToggle: () => void;\n}) => {\n const { option, name, checked, editable, onToggle } = props;\n\n return (\n <Checkbox\n name={name}\n checked={checked}\n readOnly={!editable}\n aria-readonly={editable ? undefined : \"true\"}\n inputProps={editable ? undefined : { tabIndex: -1 }}\n alignItems=\"flex-start\"\n onCheckedChange={editable ? onToggle : undefined}\n >\n <QuestionOptionContent option={option} />\n </Checkbox>\n );\n};\n\nconst QuestionRadioOptions = (props: {\n question: QuestionFormBlockQuestion;\n questionIndex: number;\n name: string;\n selectedOption?: string;\n otherSelected: boolean;\n editable: boolean;\n onToggleOption?: (question: QuestionFormBlockQuestion, questionIndex: number, optionLabel: string) => void;\n onToggleOther?: (question: QuestionFormBlockQuestion, questionIndex: number) => void;\n otherField?: ReactNode;\n}) => {\n const { question, questionIndex, name, selectedOption, otherSelected, editable, onToggleOption, onToggleOther } =\n props;\n const { otherField } = props;\n const hasOtherChoice = questionOffersOtherChoice(question);\n const selectedIndex = question.options.findIndex((option) => option.label === selectedOption);\n const selectedValue = selectedIndex === -1 ? null : String(selectedIndex);\n\n return (\n <RadioGroup\n name={name}\n value={otherSelected ? OTHER_CHOICE_VALUE : selectedValue}\n readOnly={!editable}\n aria-readonly={editable ? undefined : \"true\"}\n display=\"flex\"\n flexDirection=\"column\"\n gap=\"xs\"\n onValueChange={\n editable\n ? (details) => {\n if (!details.value) return;\n if (details.value === OTHER_CHOICE_VALUE) onToggleOther?.(question, questionIndex);\n else onToggleOption?.(question, questionIndex, question.options[Number(details.value)].label);\n }\n : undefined\n }\n >\n {question.options.map((option, optionIndex) => (\n <Radio\n key={option.label}\n value={String(optionIndex)}\n inputProps={editable ? undefined : { tabIndex: -1 }}\n alignItems=\"flex-start\"\n >\n <QuestionOptionContent option={option} />\n </Radio>\n ))}\n {hasOtherChoice ? (\n <Radio value={OTHER_CHOICE_VALUE} inputProps={editable ? undefined : { tabIndex: -1 }} alignItems=\"flex-start\">\n <QuestionOptionContent option={{ label: OTHER_CHOICE_LABEL }} />\n </Radio>\n ) : null}\n {otherSelected ? otherField : null}\n </RadioGroup>\n );\n};\n\nexport const TodoListBlockView = (props: { items: TodoListBlockItem[] }) => {\n const { items } = props;\n\n return (\n <Stack as=\"ul\" gap=\"0\" listStyleType=\"none\" margin=\"0\" padding=\"0\">\n {items.map((item, index) => (\n <Box as=\"li\" key={`${item.label}-${index}`}>\n <Checkbox checked={item.checked} readOnly aria-readonly=\"true\" inputProps={{ tabIndex: -1 }} size=\"xs\">\n <Text textStyle=\"label/XS/regular\" color=\"fg\">\n {item.label}\n </Text>\n </Checkbox>\n </Box>\n ))}\n </Stack>\n );\n};\n\ninterface QuestionFieldsetProps {\n question: QuestionFormBlockQuestion;\n questionIndex: number;\n editable: boolean;\n selectedOptions: string[];\n customAnswer: string | undefined;\n onToggleOption?: (question: QuestionFormBlockQuestion, questionIndex: number, optionLabel: string) => void;\n onToggleOther?: (question: QuestionFormBlockQuestion, questionIndex: number) => void;\n onCustomAnswerChange?: (question: QuestionFormBlockQuestion, questionIndex: number, answer: string) => void;\n}\n\nconst QuestionOtherField = (props: QuestionFieldsetProps & { hasOtherChoice: boolean }) => {\n const { question, questionIndex, editable, customAnswer, onCustomAnswerChange, hasOtherChoice } = props;\n const editablePlaceholder = hasOtherChoice ? \"Type your answer...\" : \"Answer...\";\n\n return (\n <Textarea\n readOnly={!editable}\n aria-readonly={editable ? undefined : \"true\"}\n value={customAnswer ?? \"\"}\n placeholder={editable ? editablePlaceholder : \"Answer\"}\n aria-label={hasOtherChoice ? `${question.question} (${OTHER_CHOICE_LABEL})` : question.question}\n rows={2}\n borderWidth=\"1px\"\n borderColor=\"border.subtle\"\n borderRadius=\"sm\"\n padding=\"xs\"\n resize={editable ? \"vertical\" : \"none\"}\n color=\"fg\"\n onChange={(event) => onCustomAnswerChange?.(question, questionIndex, event.currentTarget.value)}\n />\n );\n};\n\nconst QuestionCheckboxOptions = (props: QuestionFieldsetProps & { name: string; otherField: ReactNode }) => {\n const { question, questionIndex, editable, selectedOptions, customAnswer, onToggleOption, onToggleOther } = props;\n const { name, otherField } = props;\n const hasOtherChoice = questionOffersOtherChoice(question);\n const otherSelected = customAnswer !== undefined;\n\n return (\n <>\n {question.options.map((option) => (\n <QuestionCheckboxOptionRow\n key={option.label}\n option={option}\n name={name}\n checked={selectedOptions.includes(option.label)}\n editable={editable}\n onToggle={() => onToggleOption?.(question, questionIndex, option.label)}\n />\n ))}\n {hasOtherChoice ? (\n <QuestionCheckboxOptionRow\n option={{ label: OTHER_CHOICE_LABEL }}\n name={name}\n checked={otherSelected}\n editable={editable}\n onToggle={() => onToggleOther?.(question, questionIndex)}\n />\n ) : null}\n {otherSelected ? otherField : null}\n </>\n );\n};\n\nconst QuestionFieldset = (props: QuestionFieldsetProps) => {\n const { question, questionIndex, editable, selectedOptions, customAnswer, onToggleOption, onToggleOther } = props;\n const name = question.id ?? `question-${questionIndex}`;\n const hasOtherChoice = questionOffersOtherChoice(question);\n const otherField = question.allowCustomAnswer ? (\n <QuestionOtherField {...props} hasOtherChoice={hasOtherChoice} />\n ) : null;\n const hasChoices = question.options.length > 0 || hasOtherChoice;\n\n return (\n <Stack\n as=\"fieldset\"\n gap=\"xs\"\n borderWidth=\"1px\"\n borderColor=\"border.subtle\"\n borderRadius=\"sm\"\n padding=\"sm\"\n minWidth=\"0\"\n >\n <Text as=\"legend\" textStyle=\"label/S/medium\" color=\"fg\" paddingX=\"2xs\">\n {question.question}\n </Text>\n {hasChoices && question.multiple ? (\n <QuestionCheckboxOptions {...props} name={name} otherField={otherField} />\n ) : null}\n {hasChoices && !question.multiple ? (\n <QuestionRadioOptions\n question={question}\n questionIndex={questionIndex}\n name={name}\n selectedOption={selectedOptions[0]}\n otherSelected={customAnswer !== undefined}\n editable={editable}\n onToggleOption={onToggleOption}\n onToggleOther={onToggleOther}\n otherField={otherField}\n />\n ) : null}\n {/* Free text with nothing to choose between is not part of a choice group. */}\n {hasChoices ? null : otherField}\n </Stack>\n );\n};\n\nexport const QuestionFormBlockView = (props: QuestionFormBlockViewProps) => {\n const {\n questions,\n editable = false,\n selectedOptionsByQuestion = {},\n customAnswersByQuestion = {},\n onToggleOption,\n onToggleOther,\n onCustomAnswerChange,\n } = props;\n\n return (\n <Stack as=\"form\" gap=\"sm\" onSubmit={preventSubmit} aria-label=\"Question form\">\n {questions.map((question, questionIndex) => {\n const name = question.id ?? `question-${questionIndex}`;\n\n return (\n <QuestionFieldset\n key={name}\n question={question}\n questionIndex={questionIndex}\n editable={editable}\n selectedOptions={getOwnQuestionValue(selectedOptionsByQuestion, name) ?? []}\n customAnswer={getOwnQuestionValue(customAnswersByQuestion, name)}\n onToggleOption={onToggleOption}\n onToggleOther={onToggleOther}\n onCustomAnswerChange={onCustomAnswerChange}\n />\n );\n })}\n </Stack>\n );\n};\n","import { HStack, Stack } from \"@chakra-ui/react\";\nimport { useEffect, useRef, useState } from \"react\";\nimport {\n type ChatInputQuestion,\n type ChatInputQuestionCustomAnswers,\n type ChatInputQuestionPrompt,\n getQuestionPromptSignature,\n getQuestionSelectionKey,\n isQuestionOtherSelected,\n} from \"./chat-input-question-answers\";\nimport { QuestionStepTab } from \"./chat-input-question-step-tab\";\nimport { useQuestionNavigation } from \"./chat-question-navigation\";\nimport { getOwnQuestionValue } from \"./question-choices\";\nimport { QuestionFormBlockView } from \"./timeline-tool-blocks\";\n\nexport * from \"./chat-input-question-answers\";\n\nexport interface QuestionPromptControlsProps {\n isEditable: boolean;\n questionPrompt: ChatInputQuestionPrompt;\n selectedOptionsByQuestion: Record<string, string[]>;\n customAnswersByQuestion: ChatInputQuestionCustomAnswers;\n onToggleOption: (question: ChatInputQuestion, questionIndex: number, optionLabel: string) => void;\n onToggleOther: (question: ChatInputQuestion, questionIndex: number) => void;\n onCustomAnswerChange: (question: ChatInputQuestion, questionIndex: number, answer: string) => void;\n}\n\ninterface QuestionPromptStepperProps extends QuestionPromptControlsProps {\n questions: ReturnType<typeof toQuestionFormQuestions>;\n}\n\nconst toQuestionFormQuestions = (questionPrompt: ChatInputQuestionPrompt) =>\n questionPrompt.questions.map((question, index) => ({\n id: getQuestionSelectionKey(question, index),\n question: question.question,\n options: question.options,\n multiple: Boolean(question.multiple),\n required: Boolean(question.required),\n allowCustomAnswer: Boolean(question.allowCustomAnswer),\n }));\n\nconst QuestionPromptStepper = (props: QuestionPromptStepperProps) => {\n const { questionPrompt, selectedOptionsByQuestion, customAnswersByQuestion, onToggleOption, onCustomAnswerChange } =\n props;\n const { onToggleOther } = props;\n const { questions, isEditable } = props;\n const [activeQuestionIndex, setActiveQuestionIndex] = useState(0);\n const questionPanelRef = useRef<HTMLDivElement>(null);\n const navigation = useQuestionNavigation();\n const selection = navigation?.selection;\n const focusRevision = selection?.revision;\n useEffect(() => {\n if (focusRevision !== undefined) questionPanelRef.current?.focus();\n }, [focusRevision]);\n const selectStep = (index: number) => {\n if (selection) navigation?.selectStep(index);\n else setActiveQuestionIndex(index);\n };\n const renderQuestionIndex = Math.min(selection?.index ?? activeQuestionIndex, questions.length - 1);\n const activeQuestion = questions[renderQuestionIndex];\n const hasMultipleQuestions = questions.length > 1;\n\n return (\n <Stack gap=\"xs\" pb=\"sm\" pt={hasMultipleQuestions ? \"0\" : \"xs\"}>\n {hasMultipleQuestions ? (\n <HStack role=\"tablist\" aria-label=\"Question steps\" gap=\"1\" minWidth=\"0\">\n {questions.map((question, questionIndex) => (\n <QuestionStepTab\n key={question.id}\n question={question}\n questionIndex={questionIndex}\n isActive={questionIndex === renderQuestionIndex}\n selectedOptionsByQuestion={selectedOptionsByQuestion}\n customAnswersByQuestion={customAnswersByQuestion}\n onSelectStep={selectStep}\n />\n ))}\n </HStack>\n ) : null}\n <Stack\n ref={questionPanelRef}\n tabIndex={-1}\n id={`question-step-panel-${activeQuestion.id}`}\n role={hasMultipleQuestions ? \"tabpanel\" : undefined}\n aria-labelledby={hasMultipleQuestions ? `question-step-tab-${activeQuestion.id}` : undefined}\n gap=\"0\"\n >\n <QuestionFormBlockView\n questions={[activeQuestion]}\n editable={isEditable}\n selectedOptionsByQuestion={selectedOptionsByQuestion}\n customAnswersByQuestion={customAnswersByQuestion}\n onToggleOption={(_question, _questionIndex, optionLabel) => {\n const question = questionPrompt.questions[renderQuestionIndex];\n const selectedOptions = getOwnQuestionValue(selectedOptionsByQuestion, activeQuestion.id) ?? [];\n const hadSelection =\n selectedOptions.length > 0 ||\n isQuestionOtherSelected(customAnswersByQuestion, question, renderQuestionIndex);\n\n onToggleOption(question, renderQuestionIndex, optionLabel);\n // Advance after the first listed radio choice. Stay when editing an answer or choosing Other\n // so the person can finish their answer; checkboxes and the last step never advance automatically.\n if (!question.multiple && !hadSelection && renderQuestionIndex < questions.length - 1) {\n // Keep keyboard focus in the panel while the previous question's controls are removed.\n questionPanelRef.current?.focus();\n selectStep(renderQuestionIndex + 1);\n }\n }}\n onToggleOther={() => {\n onToggleOther(questionPrompt.questions[renderQuestionIndex], renderQuestionIndex);\n }}\n onCustomAnswerChange={(_question, _questionIndex, answer) => {\n onCustomAnswerChange(questionPrompt.questions[renderQuestionIndex], renderQuestionIndex, answer);\n }}\n />\n </Stack>\n </Stack>\n );\n};\n\nexport const QuestionPromptControls = (props: QuestionPromptControlsProps) => {\n const { questionPrompt } = props;\n const questions = toQuestionFormQuestions(questionPrompt);\n const questionPromptSignature = getQuestionPromptSignature(questionPrompt);\n\n return <QuestionPromptStepper key={questionPromptSignature} {...props} questions={questions} />;\n};\n","import { useEffect, useRef, useState } from \"react\";\nimport {\n buildQuestionAnswerValues,\n buildQuestionResponse,\n type ChatInputQuestion,\n type ChatInputQuestionCustomAnswers,\n type ChatInputQuestionPrompt,\n clearQuestionOtherAnswer,\n getQuestionPromptSignature,\n getQuestionSelectionKey,\n hasMissingRequiredQuestionAnswer,\n toggleQuestionOptionSelection,\n toggleQuestionOtherAnswer,\n} from \"./chat-input-question-prompt\";\n\nconst defaultSelections = (prompt: ChatInputQuestionPrompt | undefined) =>\n Object.fromEntries(\n (prompt?.questions ?? []).flatMap((question, index) =>\n prompt?.delivery === \"async\" && question.options.length\n ? [[getQuestionSelectionKey(question, index), [question.options[0].label]]]\n : [],\n ),\n );\n\n/**\n * Holds what the person picked for the open question and derives what the form would send.\n * `resetToken` clears the picks whenever the composer itself is reset, such as a new draft.\n */\nexport const useQuestionPromptState = (questionPrompt: ChatInputQuestionPrompt | undefined, resetToken?: unknown) => {\n const [selectedOptionsByQuestion, setSelectedOptionsByQuestion] = useState<Record<string, string[]>>(() =>\n defaultSelections(questionPrompt),\n );\n const [customAnswersByQuestion, setCustomAnswersByQuestion] = useState<ChatInputQuestionCustomAnswers>({});\n const signature = getQuestionPromptSignature(questionPrompt);\n const previousResetRef = useRef(JSON.stringify([signature, resetToken ?? null]));\n\n const reset = () => {\n setSelectedOptionsByQuestion(defaultSelections(questionPrompt));\n setCustomAnswersByQuestion({});\n };\n\n useEffect(() => {\n const current = JSON.stringify([signature, resetToken ?? null]);\n if (previousResetRef.current === current) return;\n previousResetRef.current = current;\n setSelectedOptionsByQuestion(defaultSelections(questionPrompt));\n setCustomAnswersByQuestion({});\n }, [signature, resetToken, questionPrompt]);\n\n const toggleOption = (question: ChatInputQuestion, questionIndex: number, optionLabel: string) => {\n setSelectedOptionsByQuestion((current) =>\n toggleQuestionOptionSelection(current, question, questionIndex, optionLabel),\n );\n // A listed choice replaces Other on a single-choice question.\n if (!question.multiple) {\n setCustomAnswersByQuestion((current) => clearQuestionOtherAnswer(current, question, questionIndex));\n }\n };\n\n const toggleOther = (question: ChatInputQuestion, questionIndex: number) => {\n setCustomAnswersByQuestion((current) => toggleQuestionOtherAnswer(current, question, questionIndex));\n // Other replaces the listed choice on a single-choice question.\n if (!question.multiple) {\n setSelectedOptionsByQuestion((current) => ({\n ...current,\n [getQuestionSelectionKey(question, questionIndex)]: [],\n }));\n }\n };\n\n const setCustomAnswer = (question: ChatInputQuestion, questionIndex: number, answer: string) => {\n const key = getQuestionSelectionKey(question, questionIndex);\n setCustomAnswersByQuestion((current) => ({ ...current, [key]: answer }));\n };\n\n return {\n signature,\n selectedOptionsByQuestion,\n customAnswersByQuestion,\n reset,\n restore: (selected: Record<string, string[]>, custom: ChatInputQuestionCustomAnswers) => {\n setSelectedOptionsByQuestion(selected);\n setCustomAnswersByQuestion(custom);\n },\n toggleOption,\n toggleOther,\n setCustomAnswer,\n responseText: questionPrompt\n ? buildQuestionResponse(questionPrompt, selectedOptionsByQuestion, customAnswersByQuestion)\n : \"\",\n hasMissingRequiredAnswer: hasMissingRequiredQuestionAnswer(\n questionPrompt,\n selectedOptionsByQuestion,\n customAnswersByQuestion,\n ),\n buildAnswers: () =>\n questionPrompt\n ? buildQuestionAnswerValues(questionPrompt, selectedOptionsByQuestion, customAnswersByQuestion)\n : [],\n };\n};\n","import { Button } from \"@chakra-ui/react\";\nimport type { ReactNode } from \"react\";\nimport { useRef, useState } from \"react\";\nimport type { ChatInputAction } from \"./chat-input-actions\";\nimport {\n buildSkippedQuestionResponse,\n type ChatInputQuestionPrompt,\n type ChatInputQuestionResponse,\n QuestionPromptControls,\n SKIPPED_QUESTION_TEXT,\n toQuestionResponse,\n} from \"./chat-input-question-prompt\";\nimport { ChatInputToolbar } from \"./chat-input-toolbar\";\nimport { useQuestionNavigation } from \"./chat-question-navigation\";\nimport { useQuestionPromptState } from \"./use-question-prompt-state\";\n\ninterface ChatInputQuestionFormProps {\n prompt: ChatInputQuestionPrompt;\n actions?: ReactNode;\n disabled: boolean;\n onSubmit: (text: string, response: ChatInputQuestionResponse) => Promise<void>;\n}\n\n/** Key this form by request identity so async requests never share answer state. */\nexport const ChatInputQuestionForm = (props: ChatInputQuestionFormProps) => {\n const { prompt, actions, disabled, onSubmit } = props;\n const question = useQuestionPromptState(prompt);\n const navigation = useQuestionNavigation();\n const [submitting, setSubmitting] = useState(false);\n const inFlight = useRef(false);\n const submit = async (skip = false) => {\n if (inFlight.current || disabled || (!skip && question.hasMissingRequiredAnswer)) return;\n inFlight.current = true;\n setSubmitting(true);\n const sent = {\n selectedOptions: question.selectedOptionsByQuestion,\n customAnswers: question.customAnswersByQuestion,\n };\n const text = skip ? SKIPPED_QUESTION_TEXT : question.responseText;\n const response = skip ? buildSkippedQuestionResponse(prompt) : toQuestionResponse(prompt, question.buildAnswers());\n question.reset();\n try {\n await onSubmit(text, response);\n // Keep accepted replies locked until native history removes this request.\n } catch {\n question.restore(sent.selectedOptions, sent.customAnswers);\n inFlight.current = false;\n setSubmitting(false);\n }\n };\n return (\n <>\n <QuestionPromptControls\n isEditable={!disabled && !submitting}\n questionPrompt={prompt}\n selectedOptionsByQuestion={question.selectedOptionsByQuestion}\n customAnswersByQuestion={question.customAnswersByQuestion}\n onToggleOption={question.toggleOption}\n onToggleOther={question.toggleOther}\n onCustomAnswerChange={question.setCustomAnswer}\n />\n <ChatInputToolbar\n actions={\n <>\n {prompt.delivery === \"async\" && navigation ? (\n <Button size=\"xs\" variant=\"ghost\" disabled={submitting} onClick={navigation.close}>\n Back to message\n </Button>\n ) : null}\n {actions}\n </>\n }\n questionPrompt\n skipDisabled={disabled || submitting}\n skipTitle=\"Skip this question and let the agent continue\"\n onSkip={() => void submit(true)}\n buttonAction={\n disabled || submitting || question.hasMissingRequiredAnswer || !question.responseText ? \"none\" : \"submit\"\n }\n messageTitle=\"Send answer\"\n runAction={(action: ChatInputAction) => {\n if (action === \"submit\") void submit();\n }}\n />\n </>\n );\n};\n","import { Button, Flex, HStack, Text } from \"@chakra-ui/react\";\nimport { useRef, useState } from \"react\";\nimport { COMPOSER_CONTROL_HEIGHT } from \"./composer-constants\";\nimport type { ComposerDecision } from \"./composer-decision\";\n\ninterface ComposerDecisionToolbarProps {\n decision: ComposerDecision;\n disabled: boolean;\n}\n\nexport const ComposerDecisionToolbar = (props: ComposerDecisionToolbarProps) => {\n const { decision, disabled } = props;\n const [submitting, setSubmitting] = useState(false);\n const inFlight = useRef(false);\n const choose = async (actionId: string) => {\n const action = decision.actions.find((item) => item.id === actionId);\n if (inFlight.current || disabled || decision.pending || !action || action.disabled) return;\n inFlight.current = true;\n setSubmitting(true);\n try {\n await decision.onAction(actionId);\n } catch {\n // The host reports the error and retains this native decision for retry.\n } finally {\n inFlight.current = false;\n setSubmitting(false);\n }\n };\n return (\n <Flex aria-label=\"Plan decision\" align=\"center\" justify=\"space-between\" gap=\"xs\" wrap=\"wrap\">\n {decision.controls}\n {decision.model ? (\n <Text textStyle=\"label/S/regular\" minH={COMPOSER_CONTROL_HEIGHT} display=\"flex\" alignItems=\"center\">\n {decision.model}\n </Text>\n ) : null}\n <HStack gap=\"xs\" marginStart=\"auto\" wrap=\"wrap\" justify=\"end\">\n {decision.actions.map((action) => (\n <Button\n key={action.id}\n size=\"xs\"\n variant={action.variant}\n disabled={disabled || submitting || decision.pending || action.disabled}\n onClick={() => void choose(action.id)}\n >\n {action.label}\n </Button>\n ))}\n </HStack>\n </Flex>\n );\n};\n","import type { ReactNode } from \"react\";\nimport { ChatInputQuestionForm } from \"./chat-input-question-form\";\nimport {\n type ChatInputQuestionPrompt,\n type ChatInputQuestionResponse,\n getQuestionPromptSignature,\n} from \"./chat-input-question-prompt\";\nimport type { ComposerDecision } from \"./composer-decision\";\nimport { ComposerDecisionToolbar } from \"./composer-decision-toolbar\";\nimport type { ComposerRequest } from \"./composer-request\";\n\ninterface ComposerTakeoverProps {\n request?: ComposerRequest;\n question?: ChatInputQuestionPrompt;\n decision?: ComposerDecision;\n actions?: ReactNode;\n disabled: boolean;\n submitDisabled: boolean;\n onSubmit: (answer: string, response: ChatInputQuestionResponse) => Promise<void>;\n}\nexport const ComposerTakeover = (props: ComposerTakeoverProps) => {\n const { request, question, decision, actions, disabled, submitDisabled, onSubmit } = props;\n if (request?.kind === \"decision\" && decision)\n return <ComposerDecisionToolbar key={decision.id} decision={decision} disabled={disabled} />;\n if (request?.kind === \"question\" && question)\n return (\n <ChatInputQuestionForm\n key={getQuestionPromptSignature(question)}\n prompt={question}\n actions={actions}\n disabled={disabled || submitDisabled}\n onSubmit={onSubmit}\n />\n );\n return null;\n};\n","import { useState } from \"react\";\n\n/**\n * Track one pending focus request for the composer. The prompt editor fulfils it once it is editable,\n * so a request made while the composer is locked waits instead of being lost.\n */\nexport const useComposerFocus = (autoFocus: boolean, focusSignal: number) => {\n const [requested, setRequested] = useState(autoFocus || focusSignal !== 0);\n const [source, setSource] = useState({ autoFocus, focusSignal });\n\n if (source.autoFocus !== autoFocus || source.focusSignal !== focusSignal) {\n setSource({ autoFocus, focusSignal });\n if ((autoFocus && !source.autoFocus) || (focusSignal !== 0 && focusSignal !== source.focusSignal)) {\n setRequested(true);\n }\n }\n\n return {\n requested,\n request: () => setRequested(true),\n complete: () => setRequested(false),\n };\n};\n","import type { SessionMessage } from \"./message-types\";\n\nexport const MAX_RECENT_USER_PROMPTS = 10;\n\nexport const getRecentUserPrompts = (messages: SessionMessage[]) => {\n const prompts: string[] = [];\n for (let i = messages.length - 1; i >= 0 && prompts.length < MAX_RECENT_USER_PROMPTS; i--) {\n const message = messages[i];\n if (message.role !== \"user\") continue;\n const text = message.parts.flatMap((part) => (part.type === \"text\" ? [part.text] : [])).join(\"\");\n if (text.trim()) prompts.push(text);\n }\n return prompts;\n};\n\nexport const movePromptHistory = (\n index: number | null,\n direction: \"previous\" | \"next\",\n text: string,\n count: number,\n) => {\n if (count === 0) return null;\n if (index === null) {\n return direction === \"previous\" && text === \"\" ? { index: 0 } : null;\n }\n if (direction === \"previous\") return { index: Math.min(index + 1, count - 1) };\n return { index: index === 0 ? null : index - 1 };\n};\n","import { useEffect, useRef } from \"react\";\nimport type { PromptEditorRef } from \"../../rich-text\";\nimport { MAX_RECENT_USER_PROMPTS, movePromptHistory } from \"./chat-input-history\";\n\ninterface ChatInputHistoryOptions {\n recentUserMessages: string[];\n text: string;\n blocked: boolean;\n resetKey: string;\n onChange: (text: string) => void;\n}\n\nexport const useChatInputHistory = (options: ChatInputHistoryOptions) => {\n const { recentUserMessages, text, blocked, resetKey, onChange } = options;\n const editorRef = useRef<PromptEditorRef>(null);\n const historyIndex = useRef<number | null>(null);\n const prompts = recentUserMessages.slice(0, MAX_RECENT_USER_PROMPTS);\n const signature = JSON.stringify(prompts);\n const resetSignature = JSON.stringify([signature, resetKey, blocked]);\n const previousResetSignature = useRef(resetSignature);\n useEffect(() => {\n if (previousResetSignature.current === resetSignature) return;\n previousResetSignature.current = resetSignature;\n historyIndex.current = null;\n }, [resetSignature]);\n\n const reset = () => {\n historyIndex.current = null;\n };\n const change = (value: string) => {\n if (historyIndex.current !== null && value !== prompts[historyIndex.current]) reset();\n onChange(value);\n };\n const recall = (direction: \"previous\" | \"next\") => {\n if (blocked) return false;\n const movement = movePromptHistory(historyIndex.current, direction, text, prompts.length);\n if (!movement) return false;\n historyIndex.current = movement.index;\n const value = movement.index === null ? \"\" : prompts[movement.index];\n editorRef.current?.setEditorValue(value);\n onChange(value);\n return true;\n };\n return { editorRef, reset, change, recallPrevious: () => recall(\"previous\"), recallNext: () => recall(\"next\") };\n};\n","import { useState } from \"react\";\nimport { getTextFromSerializedEditorState } from \"../../rich-text\";\n\n// The editor's content and its plain text. A seed is not a user edit, so adopting the host's\n// `defaultState` never reports a change. Text the editor already shows (the host echoing the\n// user's own typing) keeps the mounted editor, its selection and its history.\nexport const useChatInputText = (defaultState: string) => {\n const [adoptedState, setAdoptedState] = useState(defaultState);\n const [editorState, setEditorState] = useState(defaultState);\n const [editorKey, setEditorKey] = useState(0);\n const [text, setText] = useState(() => getTextFromSerializedEditorState(defaultState));\n\n const remountEditor = (state: string) => {\n setEditorState(state);\n setEditorKey((key) => key + 1);\n };\n\n if (adoptedState !== defaultState) {\n setAdoptedState(defaultState);\n // Compare serialized text on both sides: the plain editor text has no paragraph newlines.\n const nextText = getTextFromSerializedEditorState(defaultState);\n if (nextText !== getTextFromSerializedEditorState(editorState)) {\n remountEditor(defaultState);\n setText(nextText);\n }\n }\n\n return { editorKey, editorState, remountEditor, setEditorState, setText, text };\n};\n","import { type ChatInputQuestionPrompt, getQuestionPromptSignature } from \"./chat-input-question-prompt\";\nimport type { ComposerDecision } from \"./composer-decision\";\n\nexport interface ComposerRequest {\n kind: \"question\" | \"decision\";\n id: string;\n}\n\nexport const resolveComposerRequest = (\n question: ChatInputQuestionPrompt | undefined,\n decision: Pick<ComposerDecision, \"id\"> | undefined,\n active: ComposerRequest | undefined,\n) => {\n const waiting: ComposerRequest[] = [];\n if (question) waiting.push({ kind: \"question\", id: question.callId ?? getQuestionPromptSignature(question) });\n if (decision) waiting.push({ kind: \"decision\", id: decision.id });\n return waiting.find((request) => request.kind === active?.kind && request.id === active.id) ?? waiting[0];\n};\n","import { useState } from \"react\";\nimport type { ChatInputQuestionPrompt } from \"./chat-input-question-prompt\";\nimport type { ComposerDecision } from \"./composer-decision\";\nimport { type ComposerRequest, resolveComposerRequest } from \"./composer-request\";\n\nexport const useComposerRequest = (\n question: ChatInputQuestionPrompt | undefined,\n decision: ComposerDecision | undefined,\n) => {\n const [active, setActive] = useState<ComposerRequest>();\n const request = resolveComposerRequest(question, decision, active);\n if (request?.kind !== active?.kind || request?.id !== active?.id) setActive(request);\n return request;\n};\n","import { Box, Flex, Text, useSlotRecipe } from \"@chakra-ui/react\";\nimport { type MouseEvent, type ReactNode, useState } from \"react\";\nimport { ScrollArea } from \"@/components/primitives/scroll-area\";\nimport { chatComposerRecipe } from \"@/theme/recipes/chat-composer\";\nimport { type PromptCommand, PromptEditor } from \"../../rich-text\";\nimport type { PromptSelectionSnapshot } from \"../../rich-text/prompt-input/plugins/preserve-selection-plugin\";\nimport { createSerializedPromptState } from \"../utils/editor-state\";\nimport {\n type ChatInputAction,\n resolveChatInputButtonAction,\n resolveChatInputKeyboardAction,\n} from \"./chat-input-actions\";\nimport { createAttachmentEventHandlers, DEFAULT_TEXT_ATTACHMENT_PASTE_LINE_THRESHOLD } from \"./chat-input-attachments\";\nimport type { ChatInputQuestionPrompt, ChatInputQuestionResponse } from \"./chat-input-question-prompt\";\nimport { ChatInputToolbar } from \"./chat-input-toolbar\";\nimport { COMPOSER_CONTROL_HEIGHT } from \"./composer-constants\";\nimport { type ComposerDecision, submitComposerResponse } from \"./composer-decision\";\nimport { ComposerTakeover } from \"./composer-takeover\";\nimport { useComposerFocus } from \"./use-chat-input-focus\";\nimport { useChatInputHistory } from \"./use-chat-input-history\";\nimport { useChatInputText } from \"./use-chat-input-text\";\nimport { useComposerRequest } from \"./use-composer-request\";\n\nexport interface ChatInputProps {\n /**\n * Serialized editor state for the text to show. The editor adopts it whenever its text differs\n * from what the editor shows, so a host can pass its live draft. It is never echoed to `onChange`.\n */\n defaultState: string;\n /** Plain-text prompts from the active conversation, newest first. */\n recentUserMessages?: string[];\n placeholder?: string;\n onSubmit?: (\n text: string,\n attachments: string[],\n questionResponse?: ChatInputQuestionResponse,\n ) => void | Promise<void>;\n onInterrupt?: () => void;\n onAttachFiles?: (files: File[]) => void;\n onAttachText?: (text: string) => void;\n textAttachmentPasteLineThreshold?: number;\n streaming?: boolean;\n attachedResources?: string[];\n onClearAttachments?: () => void;\n isDisabled?: boolean;\n /** Keeps the editor usable but blocks sending, for example while no model is selected. */\n submitDisabled?: boolean;\n onChange?: (text: string) => void;\n attachmentList?: ReactNode;\n actions?: ReactNode;\n /** Secondary actions immediately before the submit button. */\n submitActions?: ReactNode;\n /** Attachment controls shown only while editing a message draft. */\n attachmentActions?: ReactNode;\n attachedToTop?: boolean;\n questionPrompt?: ChatInputQuestionPrompt;\n decision?: ComposerDecision;\n autoFocus?: boolean;\n focusSignal?: number;\n submitTitle?: string;\n submitLabel?: string;\n initialSelection?: PromptSelectionSnapshot;\n onSelectionChange?: (selection: PromptSelectionSnapshot) => void;\n onEditorStateChange?: (text: string, state: string) => void;\n retainTextUntilAcknowledged?: boolean;\n commands?: PromptCommand[];\n}\n\nconst ChatInputPlaceholder = (props: { placeholder?: string }) => {\n const { placeholder } = props;\n if (!placeholder) return null;\n\n return (\n <Text textStyle=\"label/M/regular\" color=\"fg.subtle\" pointerEvents=\"none\" position=\"absolute\" top=\"0\">\n {placeholder}\n </Text>\n );\n};\n\nexport const ChatInput = (props: ChatInputProps) => {\n const {\n defaultState,\n recentUserMessages = [],\n onSubmit = () => {},\n onInterrupt,\n onAttachFiles,\n onAttachText,\n textAttachmentPasteLineThreshold = DEFAULT_TEXT_ATTACHMENT_PASTE_LINE_THRESHOLD,\n streaming = false,\n attachedResources = [],\n onClearAttachments,\n isDisabled = false,\n submitDisabled = false,\n onChange,\n placeholder,\n attachmentList,\n actions,\n submitActions,\n attachmentActions,\n attachedToTop = false,\n questionPrompt,\n decision,\n autoFocus = false,\n focusSignal = 0,\n submitTitle,\n submitLabel,\n initialSelection,\n onSelectionChange,\n onEditorStateChange,\n retainTextUntilAcknowledged = false,\n commands = [],\n } = props;\n\n const request = useComposerRequest(questionPrompt, decision);\n const occupied = Boolean(request);\n\n const styles = useSlotRecipe({ recipe: chatComposerRecipe })({ attachedToTop });\n const [submitting, setSubmitting] = useState(false);\n const { editorKey, editorState, remountEditor, setEditorState, setText, text } = useChatInputText(defaultState);\n const focus = useComposerFocus(autoFocus, focusSignal);\n\n const history = useChatInputHistory({\n recentUserMessages,\n text,\n blocked: isDisabled || submitting || occupied,\n resetKey: String(editorKey),\n onChange: (value) => {\n setText(value);\n onChange?.(value);\n },\n });\n\n const handleContainerClick = (event: MouseEvent<HTMLDivElement>) => {\n const target = event.target;\n // Portaled controls bubble through React, but own their focus outside this box.\n if (!(target instanceof Element) || !event.currentTarget.contains(target)) return;\n if (target.closest(\"button, input, textarea, select, a, label, [role=button], [role=combobox]\")) return;\n if (occupied) return;\n focus.request();\n };\n\n const replaceDraftText = (value: string) => {\n remountEditor(createSerializedPromptState(value));\n history.change(value);\n };\n\n const canSubmit = !isDisabled && !submitting && !submitDisabled && !occupied;\n const actionState = {\n canInterrupt: !occupied && Boolean(onInterrupt),\n canSubmit: !submitDisabled && !occupied,\n hasQuestionPrompt: occupied,\n isDisabled: isDisabled || submitting,\n streaming,\n text,\n };\n const buttonAction = resolveChatInputButtonAction(actionState);\n const messageTitle = streaming ? \"Queue message\" : \"Send message\";\n const submitMessage = async () => {\n if (!canSubmit || !text.trim()) return;\n const sentText = text;\n history.reset();\n setSubmitting(true);\n // The conversation owns the message from the moment it is sent.\n if (!retainTextUntilAcknowledged) replaceDraftText(\"\");\n try {\n await submitComposerResponse({ text: text.trim(), attachments: attachedResources, onSubmit, onClearAttachments });\n } catch {\n // A rejected handoff leaves the draft available for a retry.\n if (!retainTextUntilAcknowledged) replaceDraftText(sentText);\n } finally {\n setSubmitting(false);\n focus.request();\n }\n };\n\n const runAction = (action: ChatInputAction) => {\n if (action === \"interrupt\") onInterrupt?.();\n if (action === \"submit\") void submitMessage();\n };\n\n const attachmentEventHandlers = createAttachmentEventHandlers({\n onAttachFiles,\n onAttachText,\n textAttachmentPasteLineThreshold,\n });\n\n return (\n <Box\n className=\"ps-chat-composer__input\"\n css={styles.input}\n onPasteCapture={occupied ? undefined : attachmentEventHandlers.onPasteCapture}\n onDropCapture={occupied ? undefined : attachmentEventHandlers.onDropCapture}\n onDragOver={occupied ? undefined : attachmentEventHandlers.onDragOver}\n onClick={handleContainerClick}\n >\n <Flex direction=\"column\" color=\"fg\" gap=\"xs\">\n <ComposerTakeover\n request={request}\n question={questionPrompt}\n decision={decision}\n actions={actions}\n disabled={isDisabled}\n submitDisabled={submitDisabled}\n onSubmit={(answer, response) =>\n submitComposerResponse({\n text: answer,\n response,\n attachments: attachedResources,\n onSubmit,\n onClearAttachments,\n })\n }\n />\n {/* Keep the editor mounted so a takeover preserves selection, composition and undo history. */}\n <Box display={occupied ? \"none\" : undefined}>\n {attachmentList ? <Box mb=\"xs\">{attachmentList}</Box> : null}\n <ScrollArea maxH=\"10rem\" showHorizontalScrollbar={false} contentProps={{ pr: \"2xs\" }}>\n <Flex minH={COMPOSER_CONTROL_HEIGHT} align=\"center\">\n <PromptEditor\n key={editorKey}\n ref={history.editorRef}\n onRecallPrevious={history.recallPrevious}\n onRecallNext={history.recallNext}\n defaultState={editorState}\n initialSelection={initialSelection}\n onSelectionChange={onSelectionChange}\n isEditable={!isDisabled && !submitting && !occupied}\n focusRequested={focus.requested}\n onFocusRequestComplete={focus.complete}\n placeholder={<ChatInputPlaceholder placeholder={placeholder} />}\n onChange={(nextText, state) => {\n setEditorState(JSON.stringify(state));\n onEditorStateChange?.(nextText, JSON.stringify(state));\n history.change(nextText);\n }}\n onSubmit={() => runAction(resolveChatInputKeyboardAction(actionState))}\n commands={commands}\n />\n </Flex>\n </ScrollArea>\n </Box>\n {!occupied ? (\n <ChatInputToolbar\n actions={\n <>\n {attachmentActions}\n {actions}\n </>\n }\n questionPrompt={false}\n skipDisabled={false}\n skipTitle=\"\"\n onSkip={() => {}}\n buttonAction={buttonAction}\n submitTitle={submitTitle}\n submitLabel={submitLabel}\n submitActions={submitActions}\n messageTitle={messageTitle}\n runAction={runAction}\n />\n ) : null}\n </Flex>\n </Box>\n );\n};\n","import { useRef } from \"react\";\n\nexport interface MessageAnimationState {\n initialized: boolean;\n seenKeys: Set<string>;\n}\n\ninterface NextMessageAnimationStateArgs {\n itemKeys: string[];\n state: MessageAnimationState;\n}\n\nexport const messageFadeInProps = {\n animationName: \"message-fade-in\",\n animationDuration: \"200ms\",\n animationTimingFunction: \"ease-out\",\n} as const;\n\nexport const getNextMessageAnimationState = (args: NextMessageAnimationStateArgs) => {\n const animatedKeys = new Set<string>();\n const seenKeys = new Set(args.state.seenKeys);\n\n for (const key of args.itemKeys) {\n if (args.state.initialized && !seenKeys.has(key)) {\n animatedKeys.add(key);\n }\n\n seenKeys.add(key);\n }\n\n return {\n animatedKeys,\n state: {\n initialized: true,\n seenKeys,\n },\n };\n};\n\nconst itemKeysEqual = (a: string[], b: string[]) => {\n if (a.length !== b.length) return false;\n for (let index = 0; index < a.length; index += 1) if (a[index] !== b[index]) return false;\n return true;\n};\n\nexport const useMessageAnimationKeys = (itemKeys: string[]) => {\n const stateRef = useRef<MessageAnimationState>({\n initialized: false,\n seenKeys: new Set(),\n });\n // The hook mutates state during render, so React's duplicate renders (Strict\n // Mode, concurrent reconciliation) would otherwise consume the animation\n // flag on the second pass and leave the message non-animating. Cache the\n // last inputs to make repeated calls idempotent.\n const lastResultRef = useRef<{ itemKeys: string[]; animatedKeys: Set<string> } | null>(null);\n\n if (lastResultRef.current && itemKeysEqual(lastResultRef.current.itemKeys, itemKeys)) {\n return lastResultRef.current.animatedKeys;\n }\n\n const next = getNextMessageAnimationState({\n itemKeys,\n state: stateRef.current,\n });\n\n stateRef.current = next.state;\n lastResultRef.current = { itemKeys: [...itemKeys], animatedKeys: next.animatedKeys };\n\n return next.animatedKeys;\n};\n","import { Box, HStack, IconButton, Text } from \"@chakra-ui/react\";\nimport { Check, Copy } from \"lucide-react\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { Tooltip } from \"@/components/primitives/tooltip\";\nimport type { ChatMessagePart, SessionMessage } from \"./message-types\";\n\ninterface MessageActionPanelProps {\n message: SessionMessage;\n alwaysVisible?: boolean;\n copyAlwaysVisible?: boolean;\n}\n\nconst isCopyablePart = (part: ChatMessagePart): part is Extract<ChatMessagePart, { type: \"text\" }> => {\n return part.type === \"text\";\n};\n\nexport const getMessageCopyText = (message: SessionMessage) => {\n return (message.parts ?? [])\n .filter(isCopyablePart)\n .map((part) => part.text.trim())\n .filter(Boolean)\n .join(\"\\n\\n\");\n};\n\nexport const getMessageTimestampLabel = (message: SessionMessage, locale?: string, timeZone?: string) => {\n if (message.delivery === \"unsent\") return \"Not sent\";\n if (!message.createdAt) return \"\";\n\n return new Intl.DateTimeFormat(locale, {\n hour: \"numeric\",\n minute: \"2-digit\",\n timeZone,\n }).format(new Date(message.createdAt));\n};\n\nexport const MessageActionPanel = (props: MessageActionPanelProps) => {\n const { message, alwaysVisible = false, copyAlwaysVisible = alwaysVisible } = props;\n const [isCopied, setIsCopied] = useState(false);\n const copyResetTimeoutRef = useRef<number | null>(null);\n const copyText = getMessageCopyText(message);\n const timestampLabel = getMessageTimestampLabel(message);\n\n useEffect(() => {\n return () => {\n if (copyResetTimeoutRef.current !== null) {\n window.clearTimeout(copyResetTimeoutRef.current);\n }\n };\n }, []);\n\n const copyMessage = async () => {\n if (!copyText) return;\n\n try {\n await navigator.clipboard.writeText(copyText);\n setIsCopied(true);\n if (copyResetTimeoutRef.current !== null) {\n window.clearTimeout(copyResetTimeoutRef.current);\n }\n copyResetTimeoutRef.current = window.setTimeout(() => setIsCopied(false), 1200);\n } catch {\n setIsCopied(false);\n }\n };\n\n if (!copyText && !timestampLabel) return null;\n\n return (\n <HStack\n data-chat-message-action-panel=\"true\"\n gap=\"2xs\"\n minH=\"6\"\n opacity={alwaysVisible ? \"1\" : \"0\"}\n pointerEvents={alwaysVisible ? \"auto\" : \"none\"}\n transition=\"opacity 120ms ease\"\n css={messageActionPanelHoverStyles}\n >\n {timestampLabel ? (\n <Text textStyle=\"label/XS/regular\" color=\"fg.muted\">\n {timestampLabel}\n </Text>\n ) : null}\n {copyText ? (\n <Box\n opacity={copyAlwaysVisible ? \"1\" : \"0\"}\n pointerEvents={copyAlwaysVisible ? \"auto\" : \"none\"}\n transition=\"opacity 120ms ease\"\n css={messageActionPanelHoverStyles}\n >\n <Tooltip content={isCopied ? \"Copied\" : \"Copy message\"}>\n <IconButton\n aria-label={isCopied ? \"Copied\" : \"Copy message\"}\n variant=\"ghost\"\n size=\"2xs\"\n onClick={copyMessage}\n >\n {isCopied ? <Check size={12} /> : <Copy size={12} />}\n </IconButton>\n </Tooltip>\n </Box>\n ) : null}\n </HStack>\n );\n};\n\nconst messageActionPanelHoverStyles = {\n \"[data-chat-message-with-actions]:hover &, [data-chat-message-with-actions]:focus-within &\": {\n opacity: 1,\n pointerEvents: \"auto\",\n },\n \".ai-message__root:hover &, .ai-message__root:focus-within &\": {\n opacity: 1,\n pointerEvents: \"auto\",\n },\n \"[data-scope='ai-message'][data-part='root']:hover &, [data-scope='ai-message'][data-part='root']:focus-within &\": {\n opacity: 1,\n pointerEvents: \"auto\",\n },\n};\n","import type { BoxProps } from \"@chakra-ui/react\";\nimport { Box } from \"@chakra-ui/react\";\nimport { RichMessage } from \"@/components/rich-text\";\nimport type { ChatLinkProps } from \"../links/chat-link\";\n\nexport interface ChatRichContentProps extends Omit<BoxProps, \"children\">, ChatLinkProps {\n children: string;\n streaming?: boolean;\n}\n\nconst ChatRichContent = (props: ChatRichContentProps) => {\n const { children, linkHandler, streaming, ...rest } = props;\n\n return (\n <Box {...rest}>\n <RichMessage defaultState={children} linkHandler={linkHandler} streaming={streaming} fullWidth />\n </Box>\n );\n};\n\nexport const Response = ChatRichContent;\n","import { chakra, Stack, useRecipe } from \"@chakra-ui/react\";\nimport { ArrowRight } from \"lucide-react\";\nimport { chatQuestionBubbleRecipe } from \"@/theme/recipes/chat-question-bubble\";\nimport {\n getQuestionBubbleAnswer,\n getQuestionRequestKey,\n isPendingQuestion,\n parseQuestionPrompt,\n} from \"../tool-rendering/question-prompt\";\nimport { useQuestionNavigation } from \"./chat-question-navigation\";\nimport type { ToolPart } from \"./message-types\";\n\ninterface ChatQuestionBubbleProps {\n part: ToolPart;\n}\n\nexport const ChatQuestionBubble = (props: ChatQuestionBubbleProps) => {\n const { part } = props;\n const prompt = parseQuestionPrompt(part.state?.input);\n const navigation = useQuestionNavigation();\n const recipe = useRecipe({ recipe: chatQuestionBubbleRecipe });\n if (!prompt) return null;\n const pending = isPendingQuestion(part);\n const canOpen = pending && Boolean(navigation);\n return (\n <Stack gap=\"xs\" align=\"start\">\n {prompt.questions.map((question, index) => {\n const answer = getQuestionBubbleAnswer(part, index) ?? question.options[0]?.label ?? \"Your answer\";\n const expanded =\n navigation?.activeKey === getQuestionRequestKey(part) && navigation?.selection?.index === index;\n return (\n <chakra.button\n key={question.id}\n type=\"button\"\n css={recipe({ multiline: question.question.includes(\"\\n\") })}\n data-state={pending ? \"pending\" : \"answered\"}\n disabled={!canOpen}\n aria-expanded={canOpen ? expanded : undefined}\n aria-label={`${question.question} → ${answer}${canOpen ? \". Open question\" : \"\"}`}\n onClick={() => navigation?.open(part, index)}\n >\n <span data-question-text>{question.question}</span>\n <span data-question-answer-row>\n <ArrowRight aria-hidden=\"true\" />\n <span data-question-answer>{answer}</span>\n </span>\n </chakra.button>\n );\n })}\n </Stack>\n );\n};\n","export const normalizeToolName = (value: string) => {\n return value\n .replace(/^tool-/i, \"\")\n .replace(/([a-z0-9])([A-Z])/g, \"$1_$2\")\n .replace(/[\\s-]+/g, \"_\")\n .toLowerCase();\n};\n\nexport const getToolNameLookupKeys = (value: string) => {\n const normalized = normalizeToolName(value);\n const compact = normalized.replace(/_/g, \"\");\n return [...new Set([value, normalized, compact])];\n};\n","import type { LucideIcon } from \"lucide-react\";\nimport {\n AlertTriangle,\n CircleQuestionMark,\n DotIcon,\n File,\n FileDiff,\n FileDown,\n FilePen,\n FileText,\n FileUp,\n Globe,\n ListTodo,\n ListTree,\n Move,\n Search,\n Terminal,\n Trash2,\n} from \"lucide-react\";\nimport { normalizeToolName } from \"./tool-name\";\n\nconst toolIconMap = {\n shell: Terminal,\n ls: ListTree,\n read_file: FileText,\n write_file: FilePen,\n delete_file: Trash2,\n patch: FileDiff,\n upload_files: FileUp,\n download_file: FileDown,\n move_file: Move,\n} as const satisfies Record<string, LucideIcon>;\n\nconst iconMap = {\n dot: DotIcon,\n danger: AlertTriangle,\n search: Search,\n browser: Globe,\n file: File,\n question: CircleQuestionMark,\n todo: ListTodo,\n terminal: Terminal,\n ...toolIconMap,\n} as const satisfies Record<string, LucideIcon>;\n\nexport type IconName = keyof typeof iconMap;\nexport type ToolIconName = keyof typeof toolIconMap;\n\nconst DEFAULT_TOOL_ICON: IconName = \"dot\";\n\nconst isToolIconName = (value: string): value is ToolIconName => Object.hasOwn(toolIconMap, value);\n\nexport const getIconComponent = (name: IconName): LucideIcon => {\n return iconMap[name];\n};\n\nexport const toolTypeToIconName = (type?: string): IconName => {\n if (!type) return DEFAULT_TOOL_ICON;\n\n const normalized = normalizeToolName(type);\n if (isToolIconName(normalized)) return normalized;\n\n const compact = normalized.replace(/_/g, \"\");\n\n switch (normalized) {\n case \"read\":\n return \"file\";\n case \"bash\":\n return \"terminal\";\n case \"edit\":\n return \"write_file\";\n case \"apply_patch\":\n return \"patch\";\n case \"grep\":\n return \"search\";\n case \"glob\":\n return \"file\";\n case \"todowrite\":\n return \"todo\";\n case \"search\":\n return \"search\";\n case \"browser\":\n return \"browser\";\n case \"question\":\n return \"question\";\n case \"fs\":\n case \"file\":\n return \"file\";\n default:\n return compact === \"todowrite\" || compact === \"todo\" ? \"todo\" : DEFAULT_TOOL_ICON;\n }\n};\n\nexport { getFileTypeIcon } from \"../../../utils/get-file-type-icon\";\n","import type { TitleSegment } from \"../components/timeline\";\n\nexport type FileChange = { filePath: string; additions: number; deletions: number };\n\nexport function basenameSafe(path: string) {\n const idx = path.lastIndexOf(\"/\");\n return idx >= 0 ? path.slice(idx + 1) : path;\n}\n\nfunction normalizeHeaderPath(input?: string | null) {\n if (!input) return null;\n\n const token = input.split(\"\\t\")[0].trim();\n if (token === \"/dev/null\") return null;\n\n let normalized = token;\n if (normalized.startsWith(\"a/\") || normalized.startsWith(\"b/\")) {\n normalized = normalized.slice(2);\n }\n\n return normalized.replace(/^\\/+/, \"\").replace(/\\\\/g, \"/\");\n}\n\nconst isMinusHeader = (line: string) => line.startsWith(\"--- \");\nconst isPlusHeader = (line: string) => line.startsWith(\"+++ \");\nconst isHunkHeader = (line: string) => line.startsWith(\"@@\");\nconst isAddedLine = (line: string) => line.startsWith(\"+\") && !(isPlusHeader(line) || line === \"+++\");\nconst isDeletedLine = (line: string) => line.startsWith(\"-\") && !(isMinusHeader(line) || line === \"---\");\n\nconst ensureFileChange = (changes: Map<string, { additions: number; deletions: number }>, filePath: string) => {\n if (!changes.has(filePath)) {\n changes.set(filePath, { additions: 0, deletions: 0 });\n }\n};\n\nconst incrementAdditions = (changes: Map<string, { additions: number; deletions: number }>, filePath: string) => {\n const current = changes.get(filePath);\n if (!current) return;\n current.additions += 1;\n};\n\nconst incrementDeletions = (changes: Map<string, { additions: number; deletions: number }>, filePath: string) => {\n const current = changes.get(filePath);\n if (!current) return;\n current.deletions += 1;\n};\n\ntype UnifiedDiffState = {\n currentPath: string | null;\n lastMinusHeader: string | null;\n inHunk: boolean;\n};\n\nconst processUnifiedDiffLine = (\n line: string,\n state: UnifiedDiffState,\n changes: Map<string, { additions: number; deletions: number }>,\n) => {\n if (isMinusHeader(line)) {\n return { ...state, lastMinusHeader: normalizeHeaderPath(line.slice(4)), inHunk: false };\n }\n\n if (isPlusHeader(line)) {\n const plusPath = normalizeHeaderPath(line.slice(4));\n const currentPath = plusPath ?? state.lastMinusHeader;\n if (currentPath) ensureFileChange(changes, currentPath);\n return { ...state, currentPath, inHunk: false };\n }\n\n if (!state.currentPath) return state;\n\n if (isHunkHeader(line)) {\n return { ...state, inHunk: true };\n }\n\n if (!state.inHunk) return state;\n\n if (isAddedLine(line)) {\n incrementAdditions(changes, state.currentPath);\n return state;\n }\n\n if (isDeletedLine(line)) {\n incrementDeletions(changes, state.currentPath);\n }\n\n return state;\n};\n\nexport function parseUnifiedDiff(diffText?: string) {\n if (!diffText || typeof diffText !== \"string\") return [] as FileChange[];\n\n const changes = new Map<string, { additions: number; deletions: number }>();\n let state: UnifiedDiffState = {\n currentPath: null,\n lastMinusHeader: null,\n inHunk: false,\n };\n\n const lines = diffText.split(/\\r?\\n/);\n for (const line of lines) {\n state = processUnifiedDiffLine(line, state, changes);\n }\n\n return Array.from(changes.entries()).map(([filePath, { additions, deletions }]) => ({\n filePath,\n additions,\n deletions,\n }));\n}\n\nexport function buildDiffTitleSegments(diffText?: string) {\n return parseUnifiedDiff(diffText).map(\n (file) =>\n ({\n kind: \"diff\",\n fileName: basenameSafe(file.filePath),\n filePath: file.filePath,\n additions: file.additions,\n deletions: file.deletions,\n }) satisfies TitleSegment,\n );\n}\n\nexport function extractDiffFilePaths(diffText?: string) {\n return parseUnifiedDiff(diffText).map((file) => file.filePath);\n}\n\nexport type FileDiffPreview = { filePath: string; original: string; modified: string };\n\nconst isDiffFileBoundary = (line: string) => isMinusHeader(line) || line.startsWith(\"diff --git \");\n\nconst isInvalidHunkBodyLine = (line: string) => {\n if (line.startsWith(\" \")) return false;\n if (line.startsWith(\"+\")) return false;\n if (line.startsWith(\"-\")) return false;\n return line.trim() !== \"\";\n};\n\nconst appendHunkLine = (line: string, original: string[], modified: string[]) => {\n if (line.startsWith(\" \")) {\n const text = line.slice(1);\n original.push(text);\n modified.push(text);\n return;\n }\n\n if (line.startsWith(\"-\")) {\n original.push(line.slice(1));\n return;\n }\n\n if (line.startsWith(\"+\")) {\n modified.push(line.slice(1));\n }\n};\n\nconst parseHunkBody = (lines: string[], startIndex: number, original: string[], modified: string[]) => {\n let index = startIndex;\n\n while (index < lines.length) {\n const line = lines[index] || \"\";\n if (isDiffFileBoundary(line) || isHunkHeader(line) || isInvalidHunkBodyLine(line)) {\n break;\n }\n\n appendHunkLine(line, original, modified);\n index += 1;\n }\n\n if (original.length > 0 || modified.length > 0) {\n original.push(\"\");\n modified.push(\"\");\n }\n\n return index;\n};\n\nconst parsePreview = (lines: string[], startIndex: number) => {\n const oldHeader = normalizeHeaderPath((lines[startIndex] || \"\").slice(4));\n const next = lines[startIndex + 1] || \"\";\n if (!isPlusHeader(next)) return { nextIndex: startIndex + 1 } as const;\n\n const newHeader = normalizeHeaderPath(next.slice(4));\n const filePath = newHeader ?? oldHeader ?? \"\";\n const original: string[] = [];\n const modified: string[] = [];\n\n let index = startIndex + 2;\n while (index < lines.length) {\n const current = lines[index] || \"\";\n if (isDiffFileBoundary(current)) break;\n\n if (!isHunkHeader(current)) {\n index += 1;\n continue;\n }\n\n index = parseHunkBody(lines, index + 1, original, modified);\n }\n\n return {\n nextIndex: index,\n preview: { filePath, original: original.join(\"\\n\"), modified: modified.join(\"\\n\") } satisfies FileDiffPreview,\n } as const;\n};\n\nexport function buildFileDiffPreviews(diffText?: string) {\n if (!diffText || typeof diffText !== \"string\") return [] as FileDiffPreview[];\n\n const lines = diffText.split(/\\r?\\n/);\n const previews: FileDiffPreview[] = [];\n\n let i = 0;\n while (i < lines.length) {\n const line = lines[i] || \"\";\n if (!isMinusHeader(line)) {\n i += 1;\n continue;\n }\n\n const { nextIndex, preview } = parsePreview(lines, i);\n if (preview) previews.push(preview);\n i = Math.max(nextIndex, i + 1);\n }\n\n return previews;\n}\n","import type { ToolPart } from \"../components/message-types\";\nimport type { Block, TitleSegment } from \"../components/timeline\";\nimport { basenameSafe, buildDiffTitleSegments, buildFileDiffPreviews, extractDiffFilePaths } from \"../utils/diff\";\nimport { toolTypeToIconName } from \"../utils/get-icon\";\n\nconst TOOL_LABELS: Record<string, string> = {\n apply_patch: \"Apply patch\",\n bash: \"Run command\",\n edit: \"Edit file\",\n glob: \"Find files\",\n grep: \"Search files\",\n read: \"Read file\",\n skill: \"Load skill\",\n todowrite: \"Update todos\",\n};\n\nconst STATE_LABELS: Record<string, string> = {\n error: \"failed\",\n \"output-error\": \"failed\",\n input_streaming: \"running\",\n running: \"running\",\n completed: \"completed\",\n failed: \"failed\",\n};\n\nexport type ApplyPatchMetadataFile = {\n filePath: string;\n additions: number;\n deletions: number;\n diff?: string;\n before?: string;\n after?: string;\n};\n\nexport const normalizeToolType = (value: string) => value.replace(/^tool-/, \"\").toLowerCase();\n\nconst toTitleCase = (value: string) => {\n return value\n .split(\" \")\n .filter((token) => token.length > 0)\n .map((token) => token[0].toUpperCase() + token.slice(1))\n .join(\" \");\n};\n\nexport const getToolType = (invocation: ToolPart) => normalizeToolType(invocation.tool ?? \"tool\");\n\nexport const getToolLabel = (value: string) => {\n const normalized = normalizeToolType(value);\n return TOOL_LABELS[normalized] ?? toTitleCase(normalized.replace(/_/g, \" \"));\n};\n\nexport const getStateLabel = (invocation: ToolPart) => {\n const state = invocation.state?.status ?? invocation.status;\n if (!state || typeof state !== \"string\") return null;\n\n const normalized = state.replace(/-/g, \"_\");\n if (STATE_LABELS[normalized]) return STATE_LABELS[normalized];\n if (normalized.includes(\"stream\")) return \"running\";\n return null;\n};\n\nexport const isErrorState = (invocation: ToolPart) => {\n const state = invocation.state?.status ?? invocation.status;\n return state === \"error\" || state === \"output-error\" || state === \"failed\";\n};\n\nexport const buildIndicator = (invocation: ToolPart) => {\n if (isErrorState(invocation)) {\n return { type: \"icon\", icon: \"danger\" } as const;\n }\n\n return {\n type: \"icon\",\n icon: toolTypeToIconName(getToolType(invocation)),\n } as const;\n};\n\nexport const buildBaseTitle = (\n invocation: ToolPart,\n detail?: string,\n labelOverride?: string,\n detailStyle?: \"monospace\",\n) => {\n const label = labelOverride ?? getToolLabel(invocation.tool ?? \"tool\");\n const title: TitleSegment[] = [{ kind: \"text\", text: label, bold: true }];\n\n if (detail) {\n title.push({\n kind: \"text\",\n text: detail,\n muted: true,\n ...(detailStyle === \"monospace\" ? { truncate: true, monospace: true } : {}),\n });\n }\n\n const stateLabel = getStateLabel(invocation);\n if (stateLabel && stateLabel !== \"completed\") {\n title.push({ kind: \"text\", text: stateLabel, muted: true });\n }\n\n return title;\n};\n\nexport const getInputObject = (invocation: ToolPart) => {\n const input = invocation.state?.input;\n if (!input || typeof input !== \"object\" || Array.isArray(input)) return null;\n return input as Record<string, unknown>;\n};\n\nexport const getOutputObject = (invocation: ToolPart) => {\n const output = invocation.state?.output;\n if (!output || typeof output !== \"object\" || Array.isArray(output)) return null;\n return output as Record<string, unknown>;\n};\n\nexport const getStringValue = (value: unknown) => {\n if (typeof value === \"string\" && value.trim().length > 0) return value;\n return null;\n};\n\nexport const getObjectValue = (value: unknown) => {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return null;\n return value as Record<string, unknown>;\n};\n\nexport const getStateObject = (invocation: ToolPart, key: string) => {\n const state = getObjectValue(invocation.state);\n if (!state) return null;\n return getObjectValue(state[key]);\n};\n\nconst normalizeFilePath = (value: string) => value.replace(/\\\\/g, \"/\").replace(/^\\/+/, \"\");\n\nconst isUnifiedDiff = (value: string) => value.includes(\"--- \") && value.includes(\"+++ \") && value.includes(\"@@\");\n\nconst getApplyPatchMetadataObjects = (invocation: ToolPart) => {\n const output = getOutputObject(invocation);\n return [getStateObject(invocation, \"metadata\"), getObjectValue(output?.metadata)].filter(Boolean) as Array<\n Record<string, unknown>\n >;\n};\n\nconst parseApplyPatchMetadataFile = (entry: unknown) => {\n const record = getObjectValue(entry);\n if (!record) return null;\n\n const rawPath = getStringValue(record.filePath) ?? getStringValue(record.relativePath) ?? getStringValue(record.path);\n if (!rawPath) return null;\n\n return {\n filePath: normalizeFilePath(rawPath),\n additions: typeof record.additions === \"number\" ? record.additions : 0,\n deletions: typeof record.deletions === \"number\" ? record.deletions : 0,\n diff: getStringValue(record.diff) ?? undefined,\n before: getStringValue(record.before) ?? undefined,\n after: getStringValue(record.after) ?? undefined,\n } satisfies ApplyPatchMetadataFile;\n};\n\nexport const getApplyPatchMetadataFiles = (invocation: ToolPart) => {\n const files: ApplyPatchMetadataFile[] = [];\n\n for (const metadata of getApplyPatchMetadataObjects(invocation)) {\n const entries = Array.isArray(metadata.files) ? metadata.files : [];\n\n for (const entry of entries) {\n const parsedFile = parseApplyPatchMetadataFile(entry);\n if (!parsedFile) continue;\n files.push(parsedFile);\n }\n }\n\n return files;\n};\n\nexport const getApplyPatchInputFilePaths = (invocation: ToolPart) => {\n const input = getInputObject(invocation);\n const changes = Array.isArray(input?.changes) ? input.changes : [];\n const filePaths = changes\n .map((change) => getStringValue(getObjectValue(change)?.path))\n .filter((filePath): filePath is string => Boolean(filePath))\n .map(normalizeFilePath);\n\n return Array.from(new Set(filePaths));\n};\n\nexport const getApplyPatchDiffText = (invocation: ToolPart) => {\n const input = getInputObject(invocation);\n const inputDiff = getStringValue(input?.diff);\n if (inputDiff) return inputDiff;\n\n for (const metadata of getApplyPatchMetadataObjects(invocation)) {\n const metadataDiff = getStringValue(metadata.diff);\n if (metadataDiff) return metadataDiff;\n }\n\n const fileDiffs = getApplyPatchMetadataFiles(invocation)\n .map((file) => file.diff)\n .filter((diff): diff is string => Boolean(diff));\n if (fileDiffs.length > 0) return fileDiffs.join(\"\\n\");\n\n const patchText = getStringValue(input?.patchText);\n if (patchText && isUnifiedDiff(patchText)) return patchText;\n\n return null;\n};\n\nexport const buildApplyPatchMetadataTitleSegments = (files: ApplyPatchMetadataFile[]) => {\n const seen = new Set<string>();\n const segments: TitleSegment[] = [];\n\n for (const file of files) {\n if (seen.has(file.filePath)) continue;\n seen.add(file.filePath);\n\n segments.push({\n kind: \"diff\",\n fileName: basenameSafe(file.filePath),\n filePath: file.filePath,\n additions: file.additions,\n deletions: file.deletions,\n });\n }\n\n return segments;\n};\n\nexport const getApplyPatchMetadataReferences = (files: ApplyPatchMetadataFile[]) => {\n return Array.from(new Set(files.map((file) => file.filePath)));\n};\n\nexport const getOutputText = (invocation: ToolPart) => {\n const outputObject = getOutputObject(invocation);\n\n return (\n getStringValue(invocation.state?.output) ??\n getStringValue(outputObject?.returnDisplay) ??\n getStringValue(outputObject?.preview) ??\n getStringValue(outputObject?.stdout) ??\n getStringValue(outputObject?.content)\n );\n};\n\nexport const parseSkillContentBlock = (value: string) => {\n const match = value.match(/<skill_content(?:\\s+name=\"([^\"]+)\")?>([\\s\\S]*?)<\\/skill_content>/);\n if (!match) return null;\n\n return {\n skillName: getStringValue(match[1]) ?? undefined,\n content: getStringValue(match[2]) ?? \"\",\n };\n};\n\nexport const getSkillName = (invocation: ToolPart) => {\n const input = getInputObject(invocation);\n return (\n getStringValue(input?.name) ??\n getStringValue(input?.skillName) ??\n getStringValue(input?.skill) ??\n getStringValue(input?.skill_name) ??\n undefined\n );\n};\n\nexport const buildFileLinkSegment = (filePath: string, variant?: \"default\" | \"bubble\"): TitleSegment => {\n return {\n kind: \"link\",\n text: basenameSafe(filePath),\n filePath,\n ...(variant ? { variant } : {}),\n };\n};\n\nexport const prependErrorBlock = (invocation: ToolPart, blocks: Block[]): Block[] => {\n if (!isErrorState(invocation) || !invocation.state?.errorText) return blocks;\n const errorBlock: Block = {\n type: \"comment\",\n text: invocation.state.errorText,\n };\n return [errorBlock, ...blocks];\n};\n\nexport const getDiffBlocks = (diffText?: string | null) => {\n return buildFileDiffPreviews(diffText ?? undefined).map((preview) => ({\n type: \"diff\",\n language: \"diff\",\n original: preview.original,\n modified: preview.modified,\n sideBySide: false,\n })) satisfies Block[];\n};\n\nexport const getDiffTitleSegments = (diffText?: string | null) => buildDiffTitleSegments(diffText ?? undefined);\n\nexport const getDiffReferences = (diffText?: string | null) => extractDiffFilePaths(diffText ?? undefined);\n","import type { Block, Item } from \"../components/timeline\";\nimport {\n buildApplyPatchMetadataTitleSegments,\n buildBaseTitle,\n buildFileLinkSegment,\n buildIndicator,\n getApplyPatchDiffText,\n getApplyPatchInputFilePaths,\n getApplyPatchMetadataFiles,\n getApplyPatchMetadataReferences,\n getDiffBlocks,\n getDiffReferences,\n getDiffTitleSegments,\n prependErrorBlock,\n} from \"./shared\";\nimport type { ToolRenderer } from \"./types\";\n\nexport const renderApplyPatch: ToolRenderer = (invocation) => {\n const diffText = getApplyPatchDiffText(invocation);\n const metadataFiles = getApplyPatchMetadataFiles(invocation);\n const inputFilePaths = getApplyPatchInputFilePaths(invocation);\n\n const title = buildBaseTitle(invocation, undefined, \"Apply patch\");\n const diffSegments = getDiffTitleSegments(diffText);\n if (diffSegments.length > 0) {\n title.push(...diffSegments);\n } else if (metadataFiles.length > 0) {\n title.push(...buildApplyPatchMetadataTitleSegments(metadataFiles));\n } else {\n title.push(...inputFilePaths.map((filePath) => buildFileLinkSegment(filePath, \"bubble\")));\n }\n\n const blocks: Block[] = [...getDiffBlocks(diffText)];\n\n if (blocks.length === 0) {\n for (const file of metadataFiles) {\n if (!file.before && !file.after) continue;\n blocks.push({\n type: \"diff\",\n language: \"diff\",\n original: file.before ?? \"\",\n modified: file.after ?? \"\",\n sideBySide: false,\n });\n }\n }\n\n if (blocks.length === 0) {\n const references = getDiffReferences(diffText);\n if (references.length === 0) {\n references.push(...getApplyPatchMetadataReferences(metadataFiles));\n }\n if (references.length === 0) {\n references.push(...inputFilePaths);\n }\n if (references.length > 0) {\n blocks.push({ type: \"references\", references });\n }\n }\n\n return {\n indicator: buildIndicator(invocation),\n title,\n blocks: prependErrorBlock(invocation, blocks),\n } satisfies Item;\n};\n","import type { Block, Item } from \"../components/timeline\";\nimport {\n buildBaseTitle,\n buildFileLinkSegment,\n buildIndicator,\n getDiffBlocks,\n getInputObject,\n getOutputObject,\n getStringValue,\n prependErrorBlock,\n} from \"./shared\";\nimport type { ToolRenderer } from \"./types\";\n\nconst buildEditDiff = (original: string, modified: string) => {\n return [\n {\n type: \"diff\",\n language: \"text\",\n original,\n modified,\n sideBySide: false,\n },\n ] satisfies Block[];\n};\n\nexport const renderEdit: ToolRenderer = (invocation) => {\n const input = getInputObject(invocation);\n const output = getOutputObject(invocation);\n\n const filePath =\n getStringValue(input?.filePath) ??\n getStringValue(input?.file_path) ??\n getStringValue(output?.filePath) ??\n undefined;\n\n const original = getStringValue(output?.oldString) ?? getStringValue(input?.old_string) ?? undefined;\n const modified = getStringValue(output?.newString) ?? getStringValue(input?.new_string) ?? undefined;\n\n const title = buildBaseTitle(invocation, undefined, \"Edit file\");\n if (filePath) {\n title.push(buildFileLinkSegment(filePath));\n }\n\n const diffBlocks =\n original !== undefined && modified !== undefined\n ? buildEditDiff(original, modified)\n : getDiffBlocks(getStringValue(output?.diff));\n\n return {\n indicator: buildIndicator(invocation),\n title,\n blocks: prependErrorBlock(invocation, diffBlocks),\n } satisfies Item;\n};\n","import type { ToolPart } from \"../components/message-types\";\nimport type { Block, Item, TitleSegment } from \"../components/timeline\";\nimport { hasQuestionResponse, parseQuestionPrompt } from \"./question-prompt\";\nimport type { ToolRenderer } from \"./types\";\n\ntype QuestionRendererDependencies = {\n buildBaseTitle: (invocation: ToolPart, detail?: string, labelOverride?: string) => TitleSegment[];\n buildIndicator: (invocation: ToolPart) => Item[\"indicator\"];\n prependErrorBlock: (invocation: ToolPart, blocks: Block[]) => Block[];\n};\n\nexport const createQuestionRenderer = (deps: QuestionRendererDependencies): ToolRenderer => {\n const { buildBaseTitle, buildIndicator, prependErrorBlock } = deps;\n\n return (invocation) => {\n const responded = hasQuestionResponse(invocation.state?.output) || hasQuestionResponse(invocation.state?.metadata);\n const prompt = parseQuestionPrompt(invocation.state?.input);\n const block = prompt ? ({ type: \"question-form\", questions: prompt.questions } satisfies Block) : null;\n if (!responded && !block) return null;\n\n const fieldLabel = block ? `${block.questions.length} field${block.questions.length === 1 ? \"\" : \"s\"}` : undefined;\n const blocks = responded ? [] : [block!];\n\n return {\n indicator: buildIndicator(invocation),\n title: buildBaseTitle(invocation, fieldLabel, \"Question\"),\n blocks: prependErrorBlock(invocation, blocks),\n expandable: false,\n } satisfies Item;\n };\n};\n","import type { Block, Item } from \"../components/timeline\";\nimport {\n buildBaseTitle,\n buildFileLinkSegment,\n buildIndicator,\n getInputObject,\n getOutputObject,\n getOutputText,\n getSkillName,\n getStringValue,\n parseSkillContentBlock,\n prependErrorBlock,\n} from \"./shared\";\nimport type { ToolRenderer } from \"./types\";\n\nexport const renderRead: ToolRenderer = (invocation) => {\n const input = getInputObject(invocation);\n const output = getOutputObject(invocation);\n\n const filePath =\n getStringValue(input?.filePath) ??\n getStringValue(input?.file_path) ??\n getStringValue(input?.file) ??\n getStringValue(output?.filePath) ??\n getStringValue(output?.file) ??\n getStringValue(output?.path) ??\n undefined;\n\n const title = buildBaseTitle(invocation, undefined, \"Read file\");\n if (filePath) {\n title.push(buildFileLinkSegment(filePath));\n }\n\n return {\n indicator: buildIndicator(invocation),\n title,\n blocks: prependErrorBlock(invocation, []),\n } satisfies Item;\n};\n\nconst renderCommand = (invocation: Parameters<ToolRenderer>[0], label: string) => {\n const input = getInputObject(invocation);\n const output = getOutputObject(invocation);\n const command = getStringValue(input?.command) ?? undefined;\n\n const title = buildBaseTitle(invocation, command, label, \"monospace\");\n const blocks: Block[] = [];\n\n const outputText = getOutputText(invocation);\n if (outputText) {\n blocks.push({ type: \"code\", language: \"text\", code: outputText });\n }\n\n const stderr = getStringValue(output?.stderr);\n if (stderr && stderr !== outputText) {\n blocks.push({ type: \"code\", language: \"text\", code: stderr });\n }\n\n if (typeof output?.exitCode === \"number\") {\n blocks.push({ type: \"text\", text: `Exit code: ${output.exitCode}` });\n }\n\n return {\n indicator: buildIndicator(invocation),\n title,\n blocks: prependErrorBlock(invocation, blocks),\n } satisfies Item;\n};\n\nexport const renderBash: ToolRenderer = (invocation) => renderCommand(invocation, \"Run command\");\n\nexport const renderShell: ToolRenderer = (invocation) => renderCommand(invocation, \"Shell\");\n\nexport const renderGrep: ToolRenderer = (invocation) => {\n const input = getInputObject(invocation);\n const outputText = getOutputText(invocation);\n const query = getStringValue(input?.pattern) ?? undefined;\n\n const title = buildBaseTitle(invocation, query, \"Search files\");\n const blocks: Block[] = outputText ? [{ type: \"code\", language: \"text\", code: outputText }] : [];\n\n return {\n indicator: buildIndicator(invocation),\n title,\n blocks: prependErrorBlock(invocation, blocks),\n } satisfies Item;\n};\n\nexport const renderGlob: ToolRenderer = (invocation) => {\n const input = getInputObject(invocation);\n const outputText = getOutputText(invocation);\n const pattern = getStringValue(input?.pattern) ?? undefined;\n\n const title = buildBaseTitle(invocation, pattern, \"Find files\");\n const blocks: Block[] = [];\n\n if (outputText) {\n const references = outputText\n .split(/\\r?\\n/)\n .map((line) => line.trim())\n .filter((line) => line.length > 0);\n\n if (references.length > 0) {\n blocks.push({ type: \"references\", references });\n }\n }\n\n return {\n indicator: buildIndicator(invocation),\n title,\n blocks: prependErrorBlock(invocation, blocks),\n } satisfies Item;\n};\n\nexport const renderSkill: ToolRenderer = (invocation) => {\n const outputText = getOutputText(invocation);\n const parsedOutput = outputText ? parseSkillContentBlock(outputText) : null;\n\n const skillName = getSkillName(invocation) ?? parsedOutput?.skillName;\n const title = buildBaseTitle(invocation, skillName, \"Load skill\");\n\n const renderedContent = parsedOutput?.content ?? outputText;\n const blocks: Block[] = renderedContent ? [{ type: \"code\", language: \"markdown\", code: renderedContent }] : [];\n\n return {\n indicator: buildIndicator(invocation),\n title,\n blocks: prependErrorBlock(invocation, blocks),\n } satisfies Item;\n};\n","import type { ToolPart } from \"../components/message-types\";\nimport type { Block, Item, TitleSegment } from \"../components/timeline\";\nimport type { ToolRenderer } from \"./types\";\n\ntype TodoItem = {\n label: string;\n checked: boolean;\n};\n\ntype TodowriteRendererDependencies = {\n buildBaseTitle: (invocation: ToolPart, detail?: string, labelOverride?: string) => TitleSegment[];\n buildIndicator: (invocation: ToolPart) => Item[\"indicator\"];\n prependErrorBlock: (invocation: ToolPart, blocks: Block[]) => Block[];\n};\n\nconst getStringValue = (value: unknown) => {\n if (typeof value === \"string\" && value.trim().length > 0) return value;\n return null;\n};\n\nconst getObjectValue = (value: unknown) => {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return null;\n return value as Record<string, unknown>;\n};\n\nconst parseTodoItem = (value: unknown): TodoItem | null => {\n const todo = getObjectValue(value);\n if (!todo) return null;\n\n const content = getStringValue(todo.content) ?? getStringValue(todo.title);\n if (!content) return null;\n const status = getStringValue(todo.status);\n\n return {\n label: content,\n checked: status === \"completed\",\n };\n};\n\nconst parseTodoItems = (value: unknown) => {\n if (!value) return { items: [], explicit: false };\n\n const listSource = (() => {\n if (Array.isArray(value)) return value;\n const objectValue = getObjectValue(value);\n if (!objectValue || !Array.isArray(objectValue.todos)) return null;\n return objectValue.todos;\n })();\n\n if (!listSource) return { items: [], explicit: false };\n\n return {\n items: listSource.map(parseTodoItem).filter((todo): todo is TodoItem => todo !== null),\n explicit: true,\n };\n};\n\nexport const createTodowriteRenderer = (deps: TodowriteRendererDependencies): ToolRenderer => {\n const { buildBaseTitle, buildIndicator, prependErrorBlock } = deps;\n\n return (invocation) => {\n const inputTodos = parseTodoItems(invocation.state?.input);\n const outputTodos = parseTodoItems(invocation.state?.output);\n const todoState = outputTodos.explicit ? outputTodos : inputTodos;\n if (!todoState.explicit) return null;\n\n const todos = todoState.items;\n const countLabel = `${todos.length} item${todos.length === 1 ? \"\" : \"s\"}`;\n const title = buildBaseTitle(invocation, countLabel, \"Update todos\");\n\n if (todos.length === 0) {\n return {\n indicator: buildIndicator(invocation),\n title,\n blocks: prependErrorBlock(invocation, [{ type: \"comment\", text: \"No todos\" }]),\n } satisfies Item;\n }\n\n const blocks: Block[] = [\n {\n type: \"todo-list\",\n items: todos,\n },\n ];\n\n return {\n indicator: buildIndicator(invocation),\n title,\n blocks: prependErrorBlock(invocation, blocks),\n } satisfies Item;\n };\n};\n","import { renderApplyPatch } from \"./apply-patch-renderer\";\nimport { renderEdit } from \"./edit-renderer\";\nimport { createQuestionRenderer } from \"./question-renderer\";\nimport { buildBaseTitle, buildIndicator, prependErrorBlock } from \"./shared\";\nimport { renderBash, renderGlob, renderGrep, renderRead, renderShell, renderSkill } from \"./standard-renderers\";\nimport { createTodowriteRenderer } from \"./todowrite-renderer\";\nimport type { ToolRenderersMap } from \"./types\";\n\nconst renderQuestion = createQuestionRenderer({\n buildBaseTitle,\n buildIndicator,\n prependErrorBlock,\n});\n\nconst renderTodowrite = createTodowriteRenderer({\n buildBaseTitle,\n buildIndicator,\n prependErrorBlock,\n});\n\nexport const createDefaultToolRenderers = () => {\n return {\n apply_patch: renderApplyPatch,\n bash: renderBash,\n edit: renderEdit,\n glob: renderGlob,\n grep: renderGrep,\n question: renderQuestion,\n read: renderRead,\n shell: renderShell,\n skill: renderSkill,\n todo_write: renderTodowrite,\n todowrite: renderTodowrite,\n } satisfies ToolRenderersMap;\n};\n","import type { ToolPart } from \"../components/message-types\";\nimport type { Block, Item, TitleSegment } from \"../components/timeline\";\nimport { toolTypeToIconName } from \"../utils/get-icon\";\nimport { getToolNameLookupKeys, normalizeToolName } from \"../utils/tool-name\";\nimport { createDefaultToolRenderers } from \"./default-renderers\";\nimport type { ToolRenderersMap, ToolTimelineBuilderOptions } from \"./types\";\n\nconst STATE_LABELS: Record<string, string> = {\n error: \"failed\",\n \"output-error\": \"failed\",\n \"input-streaming\": \"running\",\n};\n\nconst toTitleCase = (value: string) => {\n return value\n .split(\" \")\n .filter((token) => token.length > 0)\n .map((token) => token[0].toUpperCase() + token.slice(1))\n .join(\" \");\n};\n\nconst getToolLabel = (tool?: string) => {\n const normalized = normalizeToolName(tool ?? \"tool\").replace(/_/g, \" \");\n return toTitleCase(normalized);\n};\n\nconst isErrorState = (state?: string) => state === \"error\" || state === \"output-error\";\n\nconst buildIndicator = (invocation: ToolPart) => {\n if (isErrorState(invocation.state?.status)) {\n return { type: \"icon\", icon: \"danger\" } as const;\n }\n\n return { type: \"icon\", icon: toolTypeToIconName(invocation.tool ?? \"tool\") } as const;\n};\n\nconst getStateLabel = (state?: unknown) => {\n if (!state || typeof state !== \"string\") return null;\n if (STATE_LABELS[state]) return STATE_LABELS[state];\n if (state.includes(\"stream\")) return \"running\";\n return null;\n};\n\nconst stringifyValue = (value: unknown) => {\n if (typeof value === \"string\") return value;\n if (value === null || value === undefined) return null;\n\n try {\n return JSON.stringify(value, null, 2);\n } catch {\n return null;\n }\n};\n\nconst isBlankValue = (value: unknown): boolean => {\n if (value === null || value === undefined) return true;\n if (typeof value === \"string\") return value.trim().length === 0;\n if (Array.isArray(value)) return value.length === 0 || value.every(isBlankValue);\n if (typeof value === \"object\") {\n return Object.values(value as Record<string, unknown>).every(isBlankValue);\n }\n return false;\n};\n\nconst getRecord = (value: unknown) => {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return null;\n return value as Record<string, unknown>;\n};\n\nconst getString = (value: unknown) => {\n if (typeof value === \"string\" && value.trim().length > 0) return value;\n return null;\n};\n\nconst getMediaType = (record: Record<string, unknown>) =>\n getString(record.mime_type) ?? getString(record.mediaType) ?? getString(record.mimeType);\n\nconst isImageMediaType = (value: string | null) => Boolean(value?.startsWith(\"image/\"));\n\nconst imageUrlPattern = /\\.(avif|bmp|gif|jpe?g|png|svg|webp)(\\?.*)?$/i;\n\nconst getImageBlock = (value: unknown, alt: string): Block | null => {\n const record = getRecord(value);\n if (!record) return null;\n\n const mediaType = getMediaType(record);\n const data = getString(record.data);\n if (data && isImageMediaType(mediaType)) {\n return { type: \"image\", src: `data:${mediaType};base64,${data}`, alt };\n }\n\n const url = getString(record.url) ?? getString(record.src);\n if (url && (isImageMediaType(mediaType) || imageUrlPattern.test(url))) {\n return { type: \"image\", src: url, alt };\n }\n\n return null;\n};\n\nconst getFileLikeOutput = (value: unknown) => {\n const record = getRecord(value);\n if (!record) return null;\n\n const filePath = getString(record.path) ?? getString(record.filePath) ?? getString(record.filename);\n const content = getString(record.content) ?? getString(record.body) ?? getString(record.text);\n if (!filePath || content === null) return null;\n\n return { filePath, content };\n};\n\nconst extensionLanguageBySuffix: Record<string, string> = {\n css: \"css\",\n html: \"html\",\n js: \"js\",\n json: \"json\",\n jsx: \"jsx\",\n md: \"markdown\",\n py: \"python\",\n ts: \"ts\",\n tsx: \"tsx\",\n yaml: \"yaml\",\n yml: \"yaml\",\n};\n\nconst getLanguageFromPath = (filePath: string) => {\n const extension = filePath.split(\".\").pop()?.toLowerCase();\n if (!extension) return \"text\";\n return extensionLanguageBySuffix[extension] ?? extension;\n};\n\nconst createLabeledBlocks = (label: string, blocks: Block[]) => {\n if (blocks.length === 0) return [];\n return [{ type: \"text\", text: label }, ...blocks] satisfies Block[];\n};\n\nconst buildBlocksForArrayValue = (value: unknown[], alt: string) => {\n const blocks: Block[] = [];\n\n for (const entry of value) {\n const entryRecord = getRecord(entry);\n const entryType = getString(entryRecord?.type);\n if (entryType === \"image\") {\n const image = getImageBlock(entry, alt);\n if (image) blocks.push(image);\n continue;\n }\n if (entryType === \"text\") {\n const text = getString(entryRecord?.text);\n if (text) blocks.push({ type: \"text\", text });\n continue;\n }\n blocks.push(...buildBlocksForValue(entry, alt));\n }\n\n return blocks;\n};\n\nconst buildBlocksForFileLikeValue = (value: unknown) => {\n const fileLikeOutput = getFileLikeOutput(value);\n if (!fileLikeOutput) return null;\n\n return [\n {\n type: \"code\",\n language: getLanguageFromPath(fileLikeOutput.filePath),\n code: fileLikeOutput.content,\n },\n ] satisfies Block[];\n};\n\nconst buildBlocksForAttachmentValue = (value: unknown) => {\n const record = getRecord(value);\n const attachmentName = getString(record?.attachment_name) ?? getString(record?.attachmentName);\n const attachmentId = getString(record?.attachment_file_id) ?? getString(record?.attachmentFileId);\n if (!attachmentName && !attachmentId) return null;\n\n return [{ type: \"text\", text: attachmentName ?? `Attachment ${attachmentId}` }] satisfies Block[];\n};\n\nconst buildBlocksForValue = (value: unknown, alt: string): Block[] => {\n if (isBlankValue(value)) return [];\n\n const imageBlock = getImageBlock(value, alt);\n if (imageBlock) return [imageBlock];\n\n if (Array.isArray(value)) return buildBlocksForArrayValue(value, alt);\n\n const fileBlocks = buildBlocksForFileLikeValue(value);\n if (fileBlocks) return fileBlocks;\n\n const attachmentBlocks = buildBlocksForAttachmentValue(value);\n if (attachmentBlocks) return attachmentBlocks;\n\n const text = stringifyValue(value);\n if (!text?.trim()) return [];\n\n return [{ type: \"code\", language: typeof value === \"string\" ? \"text\" : \"json\", code: text }] satisfies Block[];\n};\n\nconst buildGenericBlocks = (invocation: ToolPart): Block[] => {\n const blocks: Block[] = [];\n const toolLabel = getToolLabel(invocation.tool);\n\n if (isErrorState(invocation.state?.status) && invocation.state?.errorText) {\n blocks.push({ type: \"comment\", text: invocation.state.errorText });\n }\n\n blocks.push(...createLabeledBlocks(\"Input\", buildBlocksForValue(invocation.state?.input, `${toolLabel} input`)));\n blocks.push(...createLabeledBlocks(\"Output\", buildBlocksForValue(invocation.state?.output, `${toolLabel} output`)));\n\n return blocks;\n};\n\nconst createGenericItem = (invocation: ToolPart) => {\n const title: TitleSegment[] = [{ kind: \"text\", text: getToolLabel(invocation.tool), bold: true }];\n const fileLikeOutput = getFileLikeOutput(invocation.state?.output);\n if (fileLikeOutput) {\n title.push({ kind: \"link\", text: fileLikeOutput.filePath, filePath: fileLikeOutput.filePath });\n }\n const stateLabel = getStateLabel(invocation.state?.status);\n if (stateLabel) {\n title.push({ kind: \"text\", text: stateLabel, muted: true });\n }\n\n return {\n indicator: buildIndicator(invocation),\n title,\n blocks: buildGenericBlocks(invocation),\n };\n};\n\nconst isVisibleTitleSegment = (segment: TitleSegment) => {\n if (segment.kind === \"text\" || segment.kind === \"link\") return segment.text.trim().length > 0;\n if (segment.kind === \"diff\") return segment.fileName.trim().length > 0;\n return true;\n};\n\nconst isVisibleBlock = (block: Block) => {\n switch (block.type) {\n case \"comment\":\n case \"code\":\n case \"text\":\n return block.type === \"code\" ? block.code.trim().length > 0 : block.text.trim().length > 0;\n case \"diff\":\n return block.original.trim().length > 0 || block.modified.trim().length > 0;\n case \"image\":\n return block.src.trim().length > 0;\n case \"todo-list\":\n return block.items.length > 0;\n case \"question-form\":\n return block.questions.length > 0;\n case \"references\":\n return block.references.length > 0;\n case \"input\":\n case \"component\":\n return true;\n }\n};\n\nconst isVisibleItem = (item: Item) => {\n const hasTitle = item.title.some(isVisibleTitleSegment);\n const hasBlocks = (item.blocks ?? []).some(isVisibleBlock);\n return hasTitle || hasBlocks;\n};\n\nconst mergeToolRenderers = (overrides?: ToolRenderersMap) => {\n if (!overrides) return createDefaultToolRenderers();\n return { ...createDefaultToolRenderers(), ...overrides } satisfies ToolRenderersMap;\n};\n\nconst getRenderer = (invocation: ToolPart, toolRenderers: ToolRenderersMap) => {\n const rawTool = invocation.tool ?? \"tool\";\n for (const key of getToolNameLookupKeys(rawTool)) {\n const renderer = toolRenderers[key];\n if (renderer) return renderer;\n }\n\n return undefined;\n};\n\nconst renderInvocation = (\n invocation: ToolPart,\n toolRenderers: ToolRenderersMap,\n options?: ToolTimelineBuilderOptions,\n) => {\n const renderer = getRenderer(invocation, toolRenderers);\n if (renderer) {\n const rendered = renderer(invocation, options);\n if (rendered) return rendered;\n }\n\n return createGenericItem(invocation);\n};\n\nexport const buildTimelineDocFromInvocations = (invocations: ToolPart[], options?: ToolTimelineBuilderOptions) => {\n const toolRenderers = mergeToolRenderers(options?.toolRenderers);\n const items = invocations\n .map((invocation) => renderInvocation(invocation, toolRenderers, options))\n .filter(isVisibleItem);\n\n return { items };\n};\n","import { type ComponentProps, lazy, Suspense } from \"react\";\n\nconst Editor = lazy(() => import(\"./diff-editor\").then((module) => ({ default: module.DiffEditor })));\n\nexport const DiffEditor = (props: ComponentProps<typeof Editor>) => (\n <Suspense fallback={null}>\n <Editor {...props} />\n </Suspense>\n);\n","import { Avatar, Timeline as ChakraTimeline, Span } from \"@chakra-ui/react\";\nimport { getIconComponent } from \"../utils/get-icon\";\nimport type { Indicator } from \"./timeline\";\n\nexport function IndicatorView(props: { ind?: Indicator }) {\n const { ind } = props;\n if (!ind || ind.type === \"none\") return null;\n\n if (ind.type === \"icon\") {\n const IndicatorIcon = getIconComponent(ind.icon);\n return (\n <ChakraTimeline.Indicator outline=\"none\" border=\"none\" background=\"bg\" color=\"fg\">\n <Span display=\"inline-flex\" alignItems=\"center\">\n <IndicatorIcon size={14} strokeWidth={1} />\n </Span>\n </ChakraTimeline.Indicator>\n );\n }\n\n return (\n <ChakraTimeline.Indicator>\n <Avatar.Root boxSize=\"full\">\n <Avatar.Image src={ind.src} alt={ind.alt} />\n <Avatar.Fallback background=\"bg.muted\" color=\"fg.muted\" />\n </Avatar.Root>\n </ChakraTimeline.Indicator>\n );\n}\n","import { Avatar, Link, Span } from \"@chakra-ui/react\";\nimport type { MouseEvent } from \"react\";\nimport { DiffBubble } from \"@/components/diff-viewer/diff-bubble\";\nimport { Tooltip } from \"@/components/primitives/tooltip\";\nimport { ChatLinkAnchor } from \"../links/chat-link-anchor\";\nimport { useChatLinkHandler } from \"../links/chat-link-context\";\nimport type { TitleSegment } from \"./timeline\";\n\nconst handleTitleLinkClick = (\n event: MouseEvent<HTMLAnchorElement>,\n seg: Extract<TitleSegment, { kind: \"link\" }>,\n onOpenFile?: (filePath: string) => void,\n stopPropagation = false,\n) => {\n if (stopPropagation) {\n event.stopPropagation();\n }\n\n if (!seg.href) {\n event.preventDefault();\n }\n if (seg.filePath) {\n onOpenFile?.(seg.filePath);\n }\n};\n\nfunction AvatarTitleSegment({ seg }: { seg: Extract<TitleSegment, { kind: \"avatar\" }> }) {\n return (\n <Avatar.Root width=\"1.5rem\" height=\"1.5rem\">\n <Avatar.Image src={seg.src} alt={seg.alt} />\n <Avatar.Fallback background=\"bg.muted\" color=\"fg.muted\" />\n </Avatar.Root>\n );\n}\n\nfunction DiffTitleSegment({\n seg,\n onOpenFile,\n}: {\n seg: Extract<TitleSegment, { kind: \"diff\" }>;\n onOpenFile?: (filePath: string) => void;\n}) {\n return (\n <DiffBubble\n fileName={seg.fileName}\n additions={seg.additions ?? 0}\n deletions={seg.deletions ?? 0}\n onClickFileLink={() => {\n const path = seg.filePath ?? seg.fileName;\n onOpenFile?.(path);\n }}\n />\n );\n}\n\nfunction BubbleLinkTitleSegment({\n seg,\n onOpenFile,\n}: {\n seg: Extract<TitleSegment, { kind: \"link\" }>;\n onOpenFile?: (filePath: string) => void;\n}) {\n const fontWeight = seg.bold ? \"medium\" : undefined;\n const isInteractive = Boolean(seg.href || seg.filePath);\n\n return (\n <Link\n href={seg.href ?? \"#\"}\n fontWeight={fontWeight}\n color={seg.muted ? \"fg.muted\" : \"fg.muted\"}\n textDecoration=\"none\"\n cursor={isInteractive ? \"pointer\" : \"default\"}\n onClick={(event) => handleTitleLinkClick(event, seg, onOpenFile, true)}\n _hover={{\n textDecoration: \"underline\",\n color: seg.muted ? \"fg.muted\" : \"fg.blue-dark\",\n }}\n >\n {seg.text}\n </Link>\n );\n}\n\nfunction DefaultLinkTitleSegment({\n seg,\n onOpenFile,\n}: {\n seg: Extract<TitleSegment, { kind: \"link\" }>;\n onOpenFile?: (filePath: string) => void;\n}) {\n const fontWeight = seg.bold ? \"medium\" : undefined;\n\n return (\n <Link\n href={seg.href ?? \"#\"}\n fontWeight={fontWeight}\n color={seg.muted ? \"fg.muted\" : \"accent.primary\"}\n textDecoration=\"underline\"\n onClick={(event) => handleTitleLinkClick(event, seg, onOpenFile)}\n _hover={{\n color: seg.muted ? \"fg.muted\" : \"accent.primary\",\n textDecoration: \"underline\",\n }}\n >\n {seg.text}\n </Link>\n );\n}\n\nfunction TextTitleSegment({\n seg,\n isClickable,\n}: {\n seg: Extract<TitleSegment, { kind: \"text\" }>;\n isClickable?: boolean;\n}) {\n const segment = (\n <Span\n fontWeight={seg.bold ? \"medium\" : undefined}\n textStyle={seg.monospace ? \"mono/XS\" : undefined}\n color=\"fg.muted\"\n minW={seg.truncate ? \"0\" : undefined}\n overflow={seg.truncate ? \"hidden\" : undefined}\n textOverflow={seg.truncate ? \"ellipsis\" : undefined}\n whiteSpace={seg.truncate ? \"nowrap\" : undefined}\n _groupHover={{\n color: isClickable && !seg.muted ? \"fg\" : \"fg.muted\",\n }}\n >\n {seg.text}\n </Span>\n );\n\n if (!seg.truncate) return segment;\n\n return <Tooltip content={seg.text}>{segment}</Tooltip>;\n}\n\nexport function TitleInline({\n seg,\n isClickable,\n onOpenFile,\n}: {\n seg: TitleSegment;\n isClickable?: boolean;\n onOpenFile?: (filePath: string) => void;\n}) {\n const handler = useChatLinkHandler();\n if (handler && (seg.kind === \"link\" || seg.kind === \"diff\") && (seg.filePath || seg.kind === \"diff\")) {\n const path = seg.filePath ?? (seg.kind === \"diff\" ? seg.fileName : seg.text);\n return (\n <ChatLinkAnchor candidate={{ source: path, origin: \"tool\" }}>\n {seg.kind === \"diff\" ? (\n <DiffBubble fileName={seg.fileName} additions={seg.additions ?? 0} deletions={seg.deletions ?? 0} />\n ) : (\n seg.text\n )}\n </ChatLinkAnchor>\n );\n }\n switch (seg.kind) {\n case \"avatar\":\n return <AvatarTitleSegment seg={seg} />;\n case \"diff\":\n return <DiffTitleSegment seg={seg} onOpenFile={onOpenFile} />;\n case \"link\":\n return seg.variant === \"bubble\" ? (\n <BubbleLinkTitleSegment seg={seg} onOpenFile={onOpenFile} />\n ) : (\n <DefaultLinkTitleSegment seg={seg} onOpenFile={onOpenFile} />\n );\n case \"text\":\n return <TextTitleSegment seg={seg} isClickable={isClickable} />;\n default:\n return null;\n }\n}\n","import { Box, Button, Card, Timeline as ChakraTimeline, Image, Span, Stack, Text } from \"@chakra-ui/react\";\nimport { ChevronUpIcon } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\nimport { useState } from \"react\";\nimport { DiffEditor } from \"@/components/diff-viewer/lazy-diff-editor\";\nimport { ResourceBadge } from \"@/components/primitives/resource-badge\";\nimport { ScrollArea } from \"@/components/primitives/scroll-area\";\nimport type { ChatLinkProps } from \"../links/chat-link\";\nimport { ChatLinkAnchor } from \"../links/chat-link-anchor\";\nimport { ChatLinkProvider, useChatLinkHandler } from \"../links/chat-link-context\";\nimport type { IconName } from \"../utils/get-icon\";\nimport { IndicatorView } from \"./timeline-indicator\";\nimport { TitleInline } from \"./timeline-title\";\nimport { QuestionFormBlockView, TodoListBlockView } from \"./timeline-tool-blocks\";\n\nconst Timeline = ChakraTimeline;\n\nexport type TimelineDoc = {\n items: Item[];\n};\n\nexport type Item = {\n id?: string;\n timestamp?: string;\n indicator?: Indicator;\n title: TitleSegment[];\n blocks?: Block[];\n expandable?: boolean;\n};\n\nexport type Indicator =\n | { type: \"icon\"; icon: IconName; color?: string }\n | { type: \"avatar\"; src: string; alt?: string }\n | { type: \"none\" };\n\nexport type TitleSegment =\n | {\n kind: \"text\";\n text: string;\n bold?: boolean;\n muted?: boolean;\n truncate?: boolean;\n monospace?: boolean;\n }\n | { kind: \"avatar\"; src: string; alt?: string }\n | {\n kind: \"diff\";\n fileName: string;\n filePath?: string;\n additions?: number;\n deletions?: number;\n }\n | {\n kind: \"link\";\n text: string;\n href?: string;\n filePath?: string;\n bold?: boolean;\n muted?: boolean;\n variant?: \"default\" | \"bubble\";\n };\n\nexport type TodoListBlockItem = {\n label: string;\n checked: boolean;\n};\n\nexport type QuestionFormBlockOption = {\n label: string;\n description?: string;\n};\n\nexport type QuestionFormBlockQuestion = {\n id?: string;\n question: string;\n options: QuestionFormBlockOption[];\n multiple: boolean;\n required: boolean;\n allowCustomAnswer: boolean;\n};\n\nexport type Block =\n | { type: \"comment\"; text: string; reactions?: { clap?: number } }\n | { type: \"code\"; language: string; code: string; editable?: boolean }\n | {\n type: \"diff\";\n language?: string;\n original: string;\n modified: string;\n sideBySide?: boolean;\n }\n | { type: \"input\"; placeholder?: string }\n | { type: \"text\"; text: string }\n | { type: \"todo-list\"; items: TodoListBlockItem[] }\n | { type: \"question-form\"; questions: QuestionFormBlockQuestion[] }\n | { type: \"references\"; references: string[] }\n | { type: \"image\"; src: string; alt: string; caption?: string }\n | {\n type: \"component\";\n render: (ctx: { onOpenFile?: (filePath: string) => void }) => ReactNode;\n };\n\nfunction CodeBlock({ code, language }: { code: string; language?: string }) {\n return (\n <ScrollArea\n background=\"bg.code\"\n color=\"fg.muted\"\n borderWidth=\"1px\"\n borderColor=\"border.subtle\"\n borderRadius=\"md\"\n showHorizontalScrollbar\n showVerticalScrollbar={false}\n >\n <Box\n as=\"pre\"\n padding=\"sm\"\n textStyle=\"mono/XS\"\n whiteSpace=\"pre\"\n aria-label={language ? `${language} code block` : \"code block\"}\n >\n <Box as=\"code\">{code}</Box>\n </Box>\n </ScrollArea>\n );\n}\n\nfunction BlockView({ b, onOpenFile }: { b: Block; onOpenFile?: (filePath: string) => void }) {\n switch (b.type) {\n case \"comment\":\n return (\n <Card.Root>\n <Card.Body>{b.text}</Card.Body>\n {b.reactions?.clap ? (\n <Card.Footer>\n <Button>👏 {b.reactions.clap}</Button>\n </Card.Footer>\n ) : null}\n </Card.Root>\n );\n case \"code\":\n return (\n <Card.Root border=\"0\" padding=\"0\">\n <Card.Body padding=\"0\">\n <CodeBlock language={b.language} code={b.code} />\n </Card.Body>\n </Card.Root>\n );\n case \"diff\":\n return (\n <Card.Root border=\"0\" padding=\"0\">\n <Card.Body padding=\"0\">\n <Box height=\"240px\" minW=\"320px\" overflow=\"hidden\">\n <DiffEditor\n original={b.original}\n modified={b.modified}\n language={b.language}\n sideBySide={b.sideBySide ?? false}\n disableScroll={true}\n />\n </Box>\n </Card.Body>\n </Card.Root>\n );\n case \"text\":\n return (\n <Card.Root background=\"transparent\">\n <Card.Body padding=\"sm\">\n <Text textStyle=\"label/S/regular\">{b.text}</Text>\n </Card.Body>\n </Card.Root>\n );\n case \"todo-list\":\n return <TodoListBlockView items={b.items} />;\n case \"question-form\":\n return <QuestionFormBlockView questions={b.questions} />;\n case \"references\":\n return (\n <Stack mt=\"xs\" gap=\"xs\" flexDir=\"row\" flexWrap=\"wrap\">\n {b.references.map((ref) => (\n <ChatLinkAnchor key={ref} candidate={{ source: ref, origin: \"tool\" }}>\n <ResourceBadge fileName={ref} />\n </ChatLinkAnchor>\n ))}\n </Stack>\n );\n case \"image\":\n if (!b.src.trim()) return null;\n return (\n <Card.Root border=\"0\" padding=\"0\" background=\"transparent\">\n <Card.Body padding=\"0\">\n <Image\n src={b.src}\n alt={b.alt}\n maxH=\"18rem\"\n maxW=\"full\"\n objectFit=\"contain\"\n borderRadius=\"sm\"\n borderWidth=\"1px\"\n borderColor=\"border.subtle\"\n />\n {b.caption ? (\n <Text mt=\"2xs\" textStyle=\"label/XS/regular\" color=\"fg.muted\">\n {b.caption}\n </Text>\n ) : null}\n </Card.Body>\n </Card.Root>\n );\n case \"component\":\n return <>{b.render({ onOpenFile })}</>;\n }\n}\n\nfunction TimelineItemRow({\n item,\n itemKey,\n isOpen,\n canExpand,\n hasBlocks,\n onToggle,\n onOpenFile,\n}: {\n item: Item;\n itemKey: string;\n isOpen: boolean;\n canExpand: boolean;\n hasBlocks: boolean;\n onToggle: (key: string) => void;\n onOpenFile?: (filePath: string) => void;\n}) {\n return (\n <Timeline.Item gap=\"xs\" key={itemKey}>\n <Timeline.Connector>\n <Timeline.Separator />\n <IndicatorView ind={item.indicator} />\n </Timeline.Connector>\n <Timeline.Content h={isOpen ? \"auto\" : \"20px\"}>\n {item.title.length > 0 && (\n <Timeline.Title\n className=\"group\"\n fontWeight=\"normal\"\n display=\"flex\"\n alignItems=\"center\"\n minW=\"0\"\n width=\"full\"\n overflow=\"hidden\"\n cursor={canExpand ? \"pointer\" : \"default\"}\n onClick={canExpand ? () => onToggle(itemKey) : undefined}\n >\n <Span display=\"flex\" alignItems=\"center\" gap=\"sm\" flexWrap=\"nowrap\" minW=\"0\" width=\"full\">\n <Span display=\"flex\" alignItems=\"center\" gap=\"xs\" flexWrap=\"nowrap\" minW=\"0\" flex=\"1\" overflow=\"hidden\">\n {item.title.map((seg, i) => (\n <TitleInline key={i} seg={seg} isClickable={canExpand} onOpenFile={onOpenFile} />\n ))}\n </Span>\n {canExpand ? (\n <Span\n display=\"inline-flex\"\n alignItems=\"center\"\n transition=\"transform 200ms ease, color 200ms ease\"\n transform={isOpen ? \"rotate(0deg)\" : \"rotate(-180deg)\"}\n color=\"transparent\"\n flexShrink=\"0\"\n _groupHover={{ color: \"fg\" }}\n >\n <ChevronUpIcon size={12} />\n </Span>\n ) : null}\n </Span>\n </Timeline.Title>\n )}\n {hasBlocks ? (\n <Box display=\"grid\" gridTemplateRows={isOpen ? \"1fr\" : \"0fr\"} transition=\"grid-template-rows 220ms ease\">\n {isOpen ? (\n <Box\n overflow=\"hidden\"\n opacity={1}\n transform=\"translateY(0)\"\n transition=\"opacity 200ms ease, transform 200ms ease\"\n >\n {item.blocks!.map((block, i) => (\n <Box key={i}>\n <BlockView b={block} onOpenFile={onOpenFile} />\n </Box>\n ))}\n </Box>\n ) : null}\n </Box>\n ) : null}\n </Timeline.Content>\n </Timeline.Item>\n );\n}\n\ninterface TimelineFromJSONProps extends ChatLinkProps {\n data: TimelineDoc;\n /** @deprecated Use linkHandler. */\n onOpenFile?: (filePath: string) => void;\n}\n\nexport function TimelineFromJSON(props: TimelineFromJSONProps) {\n const inherited = useChatLinkHandler();\n return (\n <ChatLinkProvider handler={props.linkHandler ?? inherited}>\n <TimelineContent {...props} />\n </ChatLinkProvider>\n );\n}\n\nfunction TimelineContent(props: TimelineFromJSONProps) {\n const { data, onOpenFile } = props;\n const handler = useChatLinkHandler();\n const openFile = handler\n ? (path: string) => {\n void handler.open({ source: path, origin: \"tool\" });\n }\n : onOpenFile;\n const [expanded, setExpanded] = useState<Record<string, boolean>>({});\n\n const getKey = (it: Item, idx: number) => (it.id ? `id:${it.id}` : `idx:${idx}`);\n\n const toggle = (key: string) => {\n setExpanded((prev) => ({ ...prev, [key]: !prev[key] }));\n };\n\n return (\n <Timeline.Root variant=\"tool\">\n {data.items.map((item, idx) => {\n const key = getKey(item, idx);\n const hasBlocks = (item.blocks?.length ?? 0) > 0;\n const canExpand = (item.expandable ?? true) && hasBlocks;\n const isOpen = canExpand ? (expanded[key] ?? false) : hasBlocks;\n\n return (\n <TimelineItemRow\n key={key}\n item={item}\n itemKey={key}\n isOpen={isOpen}\n canExpand={canExpand}\n hasBlocks={hasBlocks}\n onToggle={toggle}\n onOpenFile={openFile}\n />\n );\n })}\n </Timeline.Root>\n );\n}\n","import type { ChatLinkProps } from \"../links/chat-link\";\nimport { buildTimelineDocFromInvocations } from \"../tool-rendering\";\nimport { normalizeToolName } from \"../utils/tool-name\";\nimport type { ToolPart } from \"./message-types\";\nimport { TimelineFromJSON } from \"./timeline\";\n\nexport interface ToolInvocationTimelineProps extends ChatLinkProps {\n invocations: ToolPart[];\n labeledBlocks?: boolean;\n hideQuestionForms?: boolean;\n /** @deprecated Use linkHandler. */\n onOpenFile?: (filePath: string) => void;\n}\n\nconst isQuestionTool = (invocation: ToolPart) =>\n normalizeToolName(invocation.tool ?? \"\").replace(/_/g, \"\") === \"question\";\n\nconst hasToolOutput = (invocation: ToolPart) => {\n const output = invocation.state?.output;\n if (typeof output === \"string\") return output.trim().length > 0;\n if (Array.isArray(output)) return output.length > 0;\n if (output && typeof output === \"object\") return Object.keys(output).length > 0;\n return output !== undefined && output !== null;\n};\n\nexport function ToolInvocationTimeline(props: ToolInvocationTimelineProps) {\n const { invocations, labeledBlocks, hideQuestionForms = false, onOpenFile, linkHandler } = props;\n const visibleInvocations = hideQuestionForms\n ? invocations.filter((invocation) => !isQuestionTool(invocation) || hasToolOutput(invocation))\n : invocations;\n\n if (visibleInvocations.length === 0) return null;\n\n const data = buildTimelineDocFromInvocations(visibleInvocations, { labeledBlocks });\n\n return <TimelineFromJSON data={data} linkHandler={linkHandler} onOpenFile={onOpenFile} />;\n}\n","import { Box, Image, Spinner } from \"@chakra-ui/react\";\nimport type { ReactNode } from \"react\";\nimport { AlertMessage } from \"@/components/primitives/alert\";\nimport { ResourceBadge } from \"@/components/primitives/resource-badge\";\nimport { RichMessage } from \"@/components/rich-text\";\nimport {\n ChatImageSourcesContext,\n emptyChatImageSources,\n indexChatImageSources,\n useChatImageHistory,\n} from \"../links/chat-image-sources\";\nimport type { ChatLinkProps } from \"../links/chat-link\";\nimport { ChatLinkProvider, useChatLinkHandler } from \"../links/chat-link-context\";\nimport { parseQuestionPrompt } from \"../tool-rendering/question-prompt\";\nimport { Response } from \"./ai-response\";\nimport { ChatQuestionBubble } from \"./chat-question-bubble\";\nimport type { AlertPart, ChatMessagePart, ErrorPart, FilePart, SessionMessage, ToolPart } from \"./message-types\";\nimport { ToolInvocationTimeline, type ToolInvocationTimelineProps } from \"./tool-invocation-timeline\";\n\ntype ToolInvocationTimelineComponent = (props: ToolInvocationTimelineProps) => ReactNode;\n\nexport interface MessagePartsProps extends ChatLinkProps {\n message: SessionMessage;\n streaming?: boolean;\n hideQuestionForms?: boolean;\n /** @deprecated Use linkHandler for workspace file references. */\n onOpenFile?: (filePath: string) => void;\n toolInvocationTimeline?: ToolInvocationTimelineComponent;\n}\n\nconst isToolPart = (part: ChatMessagePart): part is ToolPart => {\n return part.type === \"tool\";\n};\n\nconst filePartLabel = (part: FilePart) => part.filename ?? part.url.split(\"/\").pop() ?? \"attachment\";\n\nconst imageExtensionPattern = /\\.(avif|bmp|gif|jpe?g|png|svg|webp)$/i;\n\nconst isImageFilePart = (part: FilePart) =>\n part.mediaType?.startsWith(\"image/\") || imageExtensionPattern.test(filePartLabel(part));\n\nconst filePartThumbnail = (part: FilePart) =>\n isImageFilePart(part) ? (\n <Image\n src={part.url}\n alt={`${filePartLabel(part)} preview thumbnail`}\n boxSize=\"18px\"\n borderRadius=\"xs\"\n objectFit=\"cover\"\n />\n ) : undefined;\n\nconst openFilePart = (part: FilePart, onOpenFile?: (filePath: string) => void) => {\n if (onOpenFile) {\n onOpenFile(part.url);\n return;\n }\n\n if (typeof window !== \"undefined\") {\n window.open(part.url, \"_blank\", \"noopener,noreferrer\");\n }\n};\n\nconst getErrorMessage = (part: ErrorPart) => {\n if (part.message && part.message.trim().length > 0) {\n return part.message;\n }\n\n const { errorType } = part;\n switch (errorType) {\n case \"timeout\":\n return \"Session timed out.\";\n case \"crash\":\n return \"Session crashed unexpectedly.\";\n case \"permission\":\n return \"Permission denied.\";\n default:\n return \"An error occurred.\";\n }\n};\n\nconst ALERT_COLOR_PALETTE: Record<AlertPart[\"status\"], string> = {\n info: \"blue\",\n warning: \"orange\",\n error: \"red\",\n success: \"green\",\n loading: \"blue\",\n};\n\nconst collectToolInvocations = (parts: ChatMessagePart[], startIndex: number) => {\n const invocations: ToolPart[] = [];\n let lookahead = startIndex;\n\n while (lookahead < parts.length) {\n const nextPart = parts[lookahead];\n if (!isToolPart(nextPart) || (nextPart.tool === \"question\" && parseQuestionPrompt(nextPart.state?.input))) break;\n invocations.push(nextPart);\n lookahead += 1;\n }\n\n return { invocations, nextIndex: lookahead - 1 };\n};\n\nexport function MessagePartsRenderer(props: MessagePartsProps) {\n const inherited = useChatLinkHandler();\n return (\n <ChatLinkProvider handler={props.linkHandler ?? inherited}>\n <MessagePartsContent {...props} />\n </ChatLinkProvider>\n );\n}\n\nfunction MessagePartsContent(props: MessagePartsProps) {\n const { message, streaming = false, hideQuestionForms = false, onOpenFile, toolInvocationTimeline } = props;\n const linkHandler = useChatLinkHandler();\n const imageHistory = useChatImageHistory();\n const localImages = indexChatImageSources([message], linkHandler);\n const RenderToolInvocationTimeline = toolInvocationTimeline ?? ToolInvocationTimeline;\n const parts = message.parts ?? [];\n const nodes: ReactNode[] = [];\n\n for (let partIndex = 0; partIndex < parts.length; partIndex += 1) {\n const part = parts[partIndex];\n const key = `${message.id}-${partIndex}`;\n\n switch (part.type) {\n case \"text\":\n nodes.push(\n <ChatImageSourcesContext\n key={key}\n value={imageHistory.get(part) ?? localImages.get(part) ?? emptyChatImageSources}\n >\n <div>\n <Response streaming={streaming}>{part.text}</Response>\n </div>\n </ChatImageSourcesContext>,\n );\n break;\n case \"reasoning\":\n nodes.push(\n <Box\n key={key}\n padding=\"0\"\n css={{\n \"& .rich-text, & .rich-text *\": {\n color: \"fg.subtle !important\",\n fontSize: \".75rem !important\",\n fontWeight: \"normal !important\",\n },\n }}\n >\n <RichMessage defaultState={part.text} fullWidth />\n </Box>,\n );\n break;\n case \"tool\": {\n if (part.tool === \"question\" && parseQuestionPrompt(part.state?.input)) {\n nodes.push(<ChatQuestionBubble key={key} part={part} />);\n break;\n }\n const { invocations, nextIndex } = collectToolInvocations(parts, partIndex);\n partIndex = nextIndex;\n nodes.push(\n <Box key={key} width=\"full\">\n <RenderToolInvocationTimeline\n invocations={invocations}\n linkHandler={linkHandler}\n labeledBlocks\n hideQuestionForms={hideQuestionForms}\n onOpenFile={onOpenFile}\n />\n </Box>,\n );\n break;\n }\n case \"file\":\n nodes.push(\n <Box key={key} width=\"fit-content\">\n <ResourceBadge\n fileName={filePartLabel(part)}\n size=\"sm\"\n tone=\"neutral\"\n icon={filePartThumbnail(part)}\n onSelect={() => openFilePart(part, onOpenFile)}\n />\n </Box>,\n );\n break;\n case \"error\":\n nodes.push(\n <Box key={key} py=\"2\" width=\"full\">\n <AlertMessage borderRadius=\"xs\" status=\"error\" colorPalette=\"red\" title={getErrorMessage(part)} size=\"sm\" />\n </Box>,\n );\n break;\n case \"token_usage\":\n break;\n case \"alert\":\n nodes.push(\n <Box key={key} width=\"full\">\n <AlertMessage\n borderRadius=\"xs\"\n status={part.status === \"loading\" ? \"info\" : part.status}\n colorPalette={ALERT_COLOR_PALETTE[part.status]}\n title={part.title}\n icon={part.status === \"loading\" ? <Spinner size=\"sm\" /> : undefined}\n size=\"sm\"\n >\n {part.message}\n </AlertMessage>\n </Box>,\n );\n break;\n default:\n nodes.push(null);\n }\n }\n\n return <>{nodes}</>;\n}\n","// Keep the non-alert session parts aligned with pstdio-api-contracts/src/session-messages.ts.\n// @pstdio/ui cannot import that private package, so the public UI contract owns this copy.\nexport type SessionMessageRole = \"user\" | \"assistant\" | \"tool\" | \"system\" | \"developer\";\n\nexport type TextPart = { type: \"text\"; text: string };\n\nexport type ReasoningPart = { type: \"reasoning\"; text: string };\n\nexport type ToolPartActionType = \"read\" | \"write\" | \"execute\" | \"network\" | \"other\";\n\nexport type ToolPartStatus = \"pending\" | \"running\" | \"completed\" | \"failed\" | \"denied\";\n\nexport type ToolPart = {\n type: \"tool\";\n tool: string;\n callId?: string;\n actionType?: ToolPartActionType;\n status?: ToolPartStatus;\n state?: {\n status?: string;\n input?: unknown;\n output?: unknown;\n errorText?: string;\n metadata?: unknown;\n };\n};\n\nexport type StepStartPart = { type: \"step-start\"; snapshot?: string };\n\nexport type StepFinishPart = {\n type: \"step-finish\";\n reason?: string;\n snapshot?: string;\n cost?: number;\n tokens?: unknown;\n};\n\nexport type PatchPart = { type: \"patch\"; hash?: string; files?: unknown };\n\nexport type FilePart = {\n type: \"file\";\n fileId?: string;\n mediaType?: string;\n filename?: string;\n size?: number;\n url: string;\n};\n\nexport type LoadingPart = { type: \"loading\" };\n\nexport type ErrorPart = {\n type: \"error\";\n errorType: \"timeout\" | \"crash\" | \"permission\" | \"other\";\n message?: string;\n};\n\nexport type TokenUsagePart = {\n type: \"token_usage\";\n inputTokens: number;\n outputTokens: number;\n cacheReadTokens?: number;\n cacheWriteTokens?: number;\n};\n\nexport type AlertPart = {\n type: \"alert\";\n status: \"info\" | \"warning\" | \"error\" | \"success\" | \"loading\";\n title: string;\n message?: string;\n};\n\nexport type SessionMessagePart =\n | TextPart\n | ReasoningPart\n | ToolPart\n | StepStartPart\n | StepFinishPart\n | PatchPart\n | FilePart\n | LoadingPart\n | ErrorPart\n | TokenUsagePart;\n\nexport type ChatMessagePart = SessionMessagePart | AlertPart;\n\nexport type SessionMessage = {\n id: string;\n role: SessionMessageRole;\n parts: ChatMessagePart[];\n index?: number;\n createdAt?: number;\n // A message the user sent that never reached the server. It stays in the conversation until resent or removed.\n delivery?: \"unsent\";\n modelId?: string;\n providerId?: string;\n tokens?: {\n input?: number;\n output?: number;\n reasoning?: number;\n cache?: { read?: number; write?: number };\n };\n};\n\nexport type QueuedFollowUp = {\n /** The request is being saved. Queue actions become available after it is accepted. */\n sending?: boolean;\n revision?: string;\n model?: string | null;\n params?: Record<string, string | boolean>;\n steeringUnavailableReason?: string | null;\n steeringDelivery?: { id: string; runStartedAt: string } | null;\n id: string;\n prompt: string;\n attachments?: Array<{\n id: string;\n name: string;\n size?: number;\n mediaType?: string;\n url?: string;\n }>;\n position?: number;\n};\n\nexport type MessageOrigin = \"user\" | \"assistant\" | \"developer\";\n\nexport const getMessageOrigin = (role: string): MessageOrigin => {\n if (role === \"user\" || role === \"assistant\" || role === \"developer\") return role;\n return \"assistant\";\n};\n\nconst isReasoningToolOnlyMessage = (message: SessionMessage) => {\n const parts = message.parts ?? [];\n if (parts.length === 0) return false;\n\n const hasTextPart = parts.some((part) => part.type === \"text\" && \"text\" in part);\n if (hasTextPart) return false;\n\n return parts.some((part) => part.type === \"reasoning\" || part.type === \"tool\");\n};\n\nconst isVisibleText = (part: TextPart | ReasoningPart) => part.text.trim().length > 0;\n\nconst isVisibleAlert = (part: AlertPart) => part.title.trim().length > 0 || Boolean(part.message?.trim());\n\nconst isDisplayRenderablePart = (part: ChatMessagePart) => {\n switch (part.type) {\n case \"text\":\n case \"reasoning\":\n return isVisibleText(part);\n case \"tool\":\n case \"file\":\n case \"error\":\n return true;\n case \"alert\":\n return isVisibleAlert(part);\n default:\n return false;\n }\n};\n\n// Questions are interaction content and must remain visible even without a later assistant response.\nconst isActivityPart = (part: ChatMessagePart) =>\n part.type === \"reasoning\" || (part.type === \"tool\" && part.tool.toLowerCase() !== \"question\");\n\nconst isActivityOnlyMessage = (message: SessionMessage) => {\n if (message.role === \"user\") return false;\n if (message.parts.length === 0) return false;\n return message.parts.every(isActivityPart);\n};\n\nconst mergeBufferedActivity = (messages: SessionMessage[]) => {\n if (messages.length === 0) return null;\n\n const [first, ...rest] = messages;\n if (!first) return null;\n\n return {\n ...first,\n role: \"assistant\",\n parts: messages.flatMap((message) => message.parts),\n modelId: rest.at(-1)?.modelId ?? first.modelId,\n providerId: rest.at(-1)?.providerId ?? first.providerId,\n } satisfies SessionMessage;\n};\n\nexport const mergeReasoningToolOnlyMessages = (messages: SessionMessage[]) => {\n const merged: SessionMessage[] = [];\n\n for (const message of messages) {\n const previous = merged[merged.length - 1];\n\n if (previous && previous.role === message.role && isReasoningToolOnlyMessage(message)) {\n previous.parts = [...(previous.parts ?? []), ...(message.parts ?? [])];\n continue;\n }\n\n merged.push({\n ...message,\n parts: [...(message.parts ?? [])],\n });\n }\n\n return merged;\n};\n\nexport const normalizeChatMessagesForDisplay = (messages: SessionMessage[], options: { streaming?: boolean } = {}) => {\n const normalized: SessionMessage[] = [];\n let activityBuffer: SessionMessage[] = [];\n\n const clearActivityBuffer = () => {\n activityBuffer = [];\n };\n\n for (const message of messages) {\n const displayParts = (message.parts ?? []).filter(isDisplayRenderablePart);\n if (displayParts.length === 0) continue;\n\n const displayMessage = displayParts.length === message.parts.length ? message : { ...message, parts: displayParts };\n\n if (displayMessage.role === \"user\") {\n clearActivityBuffer();\n normalized.push(displayMessage);\n continue;\n }\n\n if (isActivityOnlyMessage(displayMessage)) {\n activityBuffer.push(displayMessage);\n continue;\n }\n\n if (activityBuffer.length > 0) {\n normalized.push({\n ...displayMessage,\n parts: [...activityBuffer.flatMap((activity) => activity.parts), ...displayMessage.parts],\n });\n clearActivityBuffer();\n continue;\n }\n\n normalized.push(displayMessage);\n }\n\n if (options.streaming && activityBuffer.length > 0) {\n const trailingActivity = mergeBufferedActivity(activityBuffer);\n if (trailingActivity) normalized.push(trailingActivity);\n }\n\n return normalized;\n};\n\nexport interface MessageGroup {\n userMessage: SessionMessage;\n responses: SessionMessage[];\n}\n\nexport const getAssistantMessageActionTargetId = (messages: SessionMessage[]) => {\n const lastMessage = messages.at(-1);\n if (lastMessage?.role !== \"assistant\") return null;\n\n const hasVisibleText = lastMessage.parts.some((part) => part.type === \"text\" && isVisibleText(part));\n return hasVisibleText ? lastMessage.id : null;\n};\n\n// Groups messages into turns: each group starts with a user message\n// followed by all non-user messages until the next user message.\nexport const groupMessagesByTurn = (messages: SessionMessage[]) => {\n const groups: MessageGroup[] = [];\n const leadingResponses: SessionMessage[] = [];\n\n for (const message of messages) {\n if (message.role === \"user\") {\n groups.push({ userMessage: message, responses: [] });\n } else if (groups.length > 0) {\n groups[groups.length - 1].responses.push(message);\n } else {\n leadingResponses.push(message);\n }\n }\n\n return { groups, leadingResponses };\n};\n","import { Button, Flex, useSlotRecipe } from \"@chakra-ui/react\";\nimport type { ReactNode } from \"react\";\nimport { ChatMessage } from \"./ai-message\";\nimport { messageFadeInProps } from \"./chat-message-animation\";\nimport { MessageActionPanel } from \"./message-action-panel\";\nimport { MessagePartsRenderer } from \"./message-parts-renderer\";\nimport { getMessageOrigin, type SessionMessage } from \"./message-types\";\n\ninterface ChatMessageListResponseProps {\n message: SessionMessage;\n streaming: boolean;\n hideQuestionForms?: boolean;\n animate?: boolean;\n showAssistantActions: boolean;\n}\n\nexport const ChatMessageListResponse = (props: ChatMessageListResponseProps) => {\n const { message, streaming, hideQuestionForms = false, animate = false, showAssistantActions } = props;\n const from = getMessageOrigin(message.role);\n const showActions = from === \"user\" || (from === \"assistant\" && showAssistantActions);\n\n return (\n <ChatMessage.Root from={from} {...(animate ? messageFadeInProps : undefined)}>\n <ChatMessage.Content from={from}>\n <MessagePartsRenderer\n message={message}\n streaming={streaming && from === \"assistant\"}\n hideQuestionForms={hideQuestionForms}\n />\n {showActions ? (\n <MessageActionPanel message={message} alwaysVisible={from === \"user\"} copyAlwaysVisible={from !== \"user\"} />\n ) : null}\n </ChatMessage.Content>\n </ChatMessage.Root>\n );\n};\n\ninterface StickyMessageToggleProps {\n expanded: boolean;\n label: string;\n onClick: () => void;\n actionPanel?: ReactNode;\n}\n\nexport const StickyMessageToggle = (props: StickyMessageToggleProps) => {\n const { expanded, label, onClick, actionPanel } = props;\n const recipe = useSlotRecipe({ key: \"stickyUserMessage\" });\n const styles = recipe({ expanded });\n\n return (\n <Flex css={styles.footer}>\n {actionPanel}\n <Button size=\"2xs\" variant=\"outline\" pointerEvents=\"auto\" onClick={onClick}>\n {label}\n </Button>\n </Flex>\n );\n};\n","import { getAssistantMessageActionTargetId, type MessageGroup, type SessionMessage } from \"./message-types\";\n\nexport type ChatMessageRow = {\n key: string;\n message: SessionMessage;\n} & (\n | { type: \"user\"; endIndex: number }\n | { type: \"response\"; userIndex: number | null; showAssistantActions: boolean; isActiveTurn: boolean }\n);\n\nexport const buildChatMessageRows = (leadingResponses: SessionMessage[], groups: MessageGroup[]) => {\n const leadingActionId = getAssistantMessageActionTargetId(leadingResponses);\n const rows: ChatMessageRow[] = leadingResponses.map((message) => ({\n type: \"response\",\n key: message.id,\n message,\n userIndex: null,\n showAssistantActions: message.id === leadingActionId,\n isActiveTurn: groups.length === 0,\n }));\n for (const [groupIndex, group] of groups.entries()) {\n const userIndex = rows.length;\n const actionId = getAssistantMessageActionTargetId(group.responses);\n rows.push({\n type: \"user\",\n key: group.userMessage.id,\n message: group.userMessage,\n endIndex: userIndex + group.responses.length,\n });\n for (const message of group.responses) {\n rows.push({\n type: \"response\",\n key: message.id,\n message,\n userIndex,\n showAssistantActions: message.id === actionId,\n isActiveTurn: groupIndex === groups.length - 1,\n });\n }\n }\n return rows;\n};\n\nexport const getChatStickyRowIndex = (rows: ChatMessageRow[], index: number) => {\n const row = rows[index];\n return row?.type === \"user\" ? index : (row?.userIndex ?? null);\n};\n\nexport const hasChatRowGap = (rows: ChatMessageRow[], index: number) => {\n const next = rows[index + 1];\n return Boolean(next) && (next.type === \"user\" || getChatStickyRowIndex(rows, index) === null);\n};\n","const SCROLL_BOUNDARY_EPSILON = 1;\n\ninterface StickyUserMessageScrollElement {\n clientHeight: number;\n scrollHeight: number;\n scrollTop: number;\n}\n\nexport const shouldStopStickyUserMessageWheel = (element: StickyUserMessageScrollElement, deltaY: number) => {\n const maxScrollTop = Math.max(0, element.scrollHeight - element.clientHeight);\n\n if (deltaY === 0 || maxScrollTop <= SCROLL_BOUNDARY_EPSILON) return false;\n if (deltaY < 0) return element.scrollTop > SCROLL_BOUNDARY_EPSILON;\n\n return element.scrollTop < maxScrollTop - SCROLL_BOUNDARY_EPSILON;\n};\n","import { Box, useSlotRecipe } from \"@chakra-ui/react\";\nimport { useLayoutEffect, useRef, useState, type WheelEvent } from \"react\";\nimport { ScrollArea } from \"@/components/primitives/scroll-area\";\nimport { ChatMessage } from \"./ai-message\";\nimport { messageFadeInProps } from \"./chat-message-animation\";\nimport { StickyMessageToggle } from \"./chat-message-list-items\";\nimport { shouldStopStickyUserMessageWheel } from \"./chat-panel-sticky-user-message\";\nimport { MessageActionPanel } from \"./message-action-panel\";\nimport { MessagePartsRenderer } from \"./message-parts-renderer\";\nimport type { SessionMessage } from \"./message-types\";\n\ninterface StickyUserMessageProps {\n message: SessionMessage;\n expanded: boolean;\n animate: boolean;\n onToggle: (messageId: string) => void;\n}\n\nconst handleWheel = (event: WheelEvent<HTMLElement>) => {\n if (shouldStopStickyUserMessageWheel(event.currentTarget, event.deltaY)) event.stopPropagation();\n};\n\nexport function StickyUserMessage(props: StickyUserMessageProps) {\n const { message, expanded, animate, onToggle } = props;\n const viewportRef = useRef<HTMLDivElement>(null);\n const bodyRef = useRef<HTMLDivElement>(null);\n const previewRef = useRef<HTMLDivElement>(null);\n const [collapsible, setCollapsible] = useState(false);\n const isExpanded = collapsible && expanded;\n const recipe = useSlotRecipe({ key: \"stickyUserMessage\" });\n const styles = recipe({ expanded: isExpanded });\n const viewportProps = {\n css: styles.viewport,\n \"data-sticky-user-message-content\": isExpanded ? \"expanded\" : \"collapsed\",\n onWheel: isExpanded ? handleWheel : undefined,\n };\n\n useLayoutEffect(() => {\n const body = bodyRef.current!;\n const preview = previewRef.current!;\n const measure = () => {\n setCollapsible(body.getBoundingClientRect().height > preview.getBoundingClientRect().height + 1);\n };\n const observer = new ResizeObserver(measure);\n observer.observe(body);\n observer.observe(preview);\n measure();\n return () => observer.disconnect();\n }, []);\n\n useLayoutEffect(() => {\n if (!isExpanded) viewportRef.current!.scrollTop = 0;\n }, [isExpanded]);\n\n const actions = <MessageActionPanel message={message} alwaysVisible copyAlwaysVisible={false} />;\n return (\n <ChatMessage.Root from=\"user\" delivery={message.delivery ?? \"sent\"} {...(animate ? messageFadeInProps : undefined)}>\n <ChatMessage.Content from=\"user\" css={styles.root}>\n <Box ref={previewRef} css={styles.preview} aria-hidden=\"true\" />\n <ScrollArea viewportRef={viewportRef} showVerticalScrollbar={isExpanded} viewportProps={viewportProps}>\n <Box ref={bodyRef} css={styles.body}>\n <MessagePartsRenderer message={message} />\n </Box>\n </ScrollArea>\n {!collapsible ? <Box css={styles.actions}>{actions}</Box> : null}\n {collapsible ? (\n <StickyMessageToggle\n expanded={isExpanded}\n label={isExpanded ? \"Show less\" : \"Show more\"}\n onClick={() => onToggle(message.id)}\n actionPanel={actions}\n />\n ) : null}\n </ChatMessage.Content>\n </ChatMessage.Root>\n );\n}\n","import { useEffect, useLayoutEffect, useRef } from \"react\";\n\nconst TAIL_READY_STABLE_FRAME_COUNT = 3;\nconst TAIL_READY_FRAME_LIMIT = 20;\nconst TAIL_READY_PIXEL_EPSILON = 1;\n\ninterface TailLayoutSnapshot {\n scrollTop: number;\n totalSize: number;\n}\n\nconst isTailLayoutStable = (current: TailLayoutSnapshot, previous: TailLayoutSnapshot) =>\n Math.abs(current.scrollTop - previous.scrollTop) <= TAIL_READY_PIXEL_EPSILON &&\n Math.abs(current.totalSize - previous.totalSize) <= TAIL_READY_PIXEL_EPSILON;\n\n// A tail that fits in the viewport has no scroll position to settle, so it can show at once.\nconst tailFitsViewport = (scrollElement: HTMLElement | null, totalSize: number) =>\n Boolean(scrollElement) && Math.max(scrollElement!.scrollHeight, totalSize) <= scrollElement!.clientHeight;\n\nconst readTailLayoutSnapshot = (scrollElement: HTMLElement | null, totalSize: number): TailLayoutSnapshot => ({\n scrollTop: scrollElement?.scrollTop ?? 0,\n totalSize,\n});\n\nexport const useTailReady = (input: {\n itemCount: number;\n onReady?: () => void;\n scrollRef: { current: HTMLElement | null };\n totalSize: number;\n}) => {\n const { itemCount, onReady, scrollRef, totalSize } = input;\n const onReadyRef = useRef(onReady);\n\n useEffect(() => {\n onReadyRef.current = onReady;\n }, [onReady]);\n\n // Runs before paint, so a conversation that fits is never hidden for the frames a long one waits.\n useLayoutEffect(() => {\n if (\n itemCount === 0 ||\n typeof requestAnimationFrame === \"undefined\" ||\n tailFitsViewport(scrollRef.current, totalSize)\n ) {\n onReadyRef.current?.();\n return;\n }\n\n let frameId = 0;\n let checkedFrameCount = 0;\n let stableFrameCount = 0;\n let previousSnapshot: TailLayoutSnapshot | null = null;\n\n const waitForStableTail = () => {\n checkedFrameCount += 1;\n\n const nextSnapshot = readTailLayoutSnapshot(scrollRef.current, totalSize);\n stableFrameCount =\n previousSnapshot && isTailLayoutStable(nextSnapshot, previousSnapshot) ? stableFrameCount + 1 : 0;\n previousSnapshot = nextSnapshot;\n\n if (stableFrameCount >= TAIL_READY_STABLE_FRAME_COUNT || checkedFrameCount >= TAIL_READY_FRAME_LIMIT) {\n onReadyRef.current?.();\n return;\n }\n\n frameId = requestAnimationFrame(waitForStableTail);\n };\n\n frameId = requestAnimationFrame(waitForStableTail);\n\n return () => cancelAnimationFrame(frameId);\n }, [itemCount, scrollRef, totalSize]);\n};\n","import { Box } from \"@chakra-ui/react\";\nimport { defaultRangeExtractor } from \"@tanstack/react-virtual\";\nimport { useStickToBottomContext } from \"use-stick-to-bottom\";\nimport { useVirtualizer } from \"@/utils/use-virtualizer\";\nimport { useMessageAnimationKeys } from \"./chat-message-animation\";\nimport { ChatMessageListResponse } from \"./chat-message-list-items\";\nimport { buildChatMessageRows, getChatStickyRowIndex, hasChatRowGap } from \"./chat-message-rows\";\nimport type { MessageGroup, SessionMessage } from \"./message-types\";\nimport { StickyUserMessage } from \"./sticky-user-message\";\nimport { useTailReady } from \"./use-chat-tail-ready\";\n\ninterface ChatMessageListProps {\n leadingResponses: SessionMessage[];\n groups: MessageGroup[];\n streaming: boolean;\n hideActiveQuestionForms: boolean;\n expandedStickyMessageIds: Set<string>;\n onToggleStickyMessage: (messageId: string) => void;\n onReady?: () => void;\n}\n\nconst ESTIMATED_MESSAGE_HEIGHT = 360;\nconst VIRTUAL_LIST_OVERSCAN = 4;\nconst VIRTUAL_LIST_GAP = 8;\n\nexport const ChatMessageList = (props: ChatMessageListProps) => {\n const {\n leadingResponses,\n groups,\n streaming,\n hideActiveQuestionForms,\n expandedStickyMessageIds,\n onToggleStickyMessage,\n onReady,\n } = props;\n const { scrollRef } = useStickToBottomContext();\n const rows = buildChatMessageRows(leadingResponses, groups);\n const animatedKeys = useMessageAnimationKeys(rows.map((row) => row.key));\n const initialHeight = scrollRef.current?.clientHeight || 1;\n const gapCount = Math.max(leadingResponses.length + groups.length - 1, 0);\n const virtualizer = useVirtualizer<HTMLDivElement, HTMLDivElement>({\n count: rows.length,\n getScrollElement: () => scrollRef.current as HTMLDivElement | null,\n estimateSize: (index) => ESTIMATED_MESSAGE_HEIGHT + (hasChatRowGap(rows, index) ? VIRTUAL_LIST_GAP : 0),\n getItemKey: (index) => rows[index].key,\n overscan: VIRTUAL_LIST_OVERSCAN,\n initialRect: { width: 0, height: initialHeight },\n initialOffset: () =>\n Math.max(rows.length * ESTIMATED_MESSAGE_HEIGHT + gapCount * VIRTUAL_LIST_GAP - initialHeight, 0),\n rangeExtractor: (range) => {\n const indexes = defaultRangeExtractor(range);\n const stickyIndex = getChatStickyRowIndex(rows, range.startIndex);\n if (stickyIndex !== null && !indexes.includes(stickyIndex)) indexes.unshift(stickyIndex);\n return indexes;\n },\n });\n const totalSize = virtualizer.getTotalSize();\n const measurements = virtualizer.measurementsCache;\n\n useTailReady({ itemCount: rows.length, onReady, scrollRef, totalSize });\n\n return (\n <Box px=\"xs\">\n <Box position=\"relative\" width=\"100%\" style={{ height: totalSize }}>\n {virtualizer.getVirtualItems().map((virtualItem) => {\n const row = rows[virtualItem.index];\n if (row.type === \"user\") {\n const end =\n (measurements[row.endIndex]?.end ?? totalSize) -\n (hasChatRowGap(rows, row.endIndex) ? VIRTUAL_LIST_GAP : 0);\n return (\n <Box\n key={virtualItem.key}\n position=\"absolute\"\n left=\"0\"\n width=\"100%\"\n zIndex={1}\n pointerEvents=\"none\"\n style={{ top: virtualItem.start, height: Math.max(virtualItem.size, end - virtualItem.start) }}\n >\n {/* Native sticky layout follows every scroll frame, including within one response. */}\n <Box\n ref={virtualizer.measureElement}\n data-index={virtualItem.index}\n data-chat-message-list-item=\"user\"\n data-chat-message-id={row.key}\n position=\"sticky\"\n top=\"0\"\n pointerEvents=\"auto\"\n pb={hasChatRowGap(rows, virtualItem.index) ? \"xs\" : undefined}\n >\n <StickyUserMessage\n message={row.message}\n expanded={expandedStickyMessageIds.has(row.key)}\n animate={animatedKeys.has(row.key)}\n onToggle={onToggleStickyMessage}\n />\n </Box>\n </Box>\n );\n }\n return (\n <Box\n key={virtualItem.key}\n ref={virtualizer.measureElement}\n data-index={virtualItem.index}\n data-chat-message-list-item={row.type}\n data-chat-message-id={row.key}\n position=\"absolute\"\n left=\"0\"\n width=\"100%\"\n pb={hasChatRowGap(rows, virtualItem.index) ? \"xs\" : undefined}\n style={{ top: virtualItem.start }}\n >\n <ChatMessageListResponse\n message={row.message}\n streaming={streaming && row.isActiveTurn && row.showAssistantActions}\n hideQuestionForms={!row.isActiveTurn || hideActiveQuestionForms}\n animate={animatedKeys.has(row.key)}\n showAssistantActions={row.showAssistantActions}\n />\n </Box>\n );\n })}\n </Box>\n </Box>\n );\n};\n","import { useEffect, useState } from \"react\";\nimport type { PromptSelectionSnapshot } from \"../../rich-text/prompt-input/plugins/preserve-selection-plugin\";\nimport { createSerializedPromptState } from \"../utils/editor-state\";\nimport type { ChatInputQuestionResponse } from \"./chat-input-question-prompt\";\nimport type { QueuedFollowUp } from \"./message-types\";\n\ninterface QueuedFollowUpComposerInput {\n queuedFollowUps: QueuedFollowUp[];\n defaultValue: string;\n onChange?: (text: string) => void;\n onSubmit?: (\n text: string,\n attachments: string[],\n questionResponse?: ChatInputQuestionResponse,\n ) => void | Promise<void>;\n onUpdate?: (itemId: string, prompt: string) => void | Promise<void>;\n onCreate?: (itemId: string, prompt: string) => void | Promise<void>;\n onRestoreDraft?: (itemId: string) => void;\n canRestoreDraft?: boolean;\n disabled?: boolean;\n onSelect?: (item: QueuedFollowUp | null) => void;\n onDiscard?: (itemId: string) => void;\n}\n\nexport const useQueuedFollowUpComposer = (input: QueuedFollowUpComposerInput) => {\n const {\n queuedFollowUps,\n defaultValue,\n onChange,\n onSubmit,\n onUpdate,\n onCreate,\n onRestoreDraft,\n canRestoreDraft = false,\n disabled = false,\n onSelect,\n onDiscard,\n } = input;\n const [editingItem, setEditingItem] = useState<QueuedFollowUp | null>(null);\n const [edits, setEdits] = useState<Record<string, { text: string; state: string }>>({});\n const [draftState, setDraftState] = useState<{ text: string; state: string } | null>(null);\n const [focusSignal, setFocusSignal] = useState(0);\n const [selections, setSelections] = useState<Record<string, PromptSelectionSnapshot>>({});\n const [error, setError] = useState<string | null>(null);\n const [updating, setUpdating] = useState(false);\n const [recoveredItemId, setRecoveredItemId] = useState<string | null>(null);\n const [notice, setNotice] = useState<string | null>(null);\n const savedItem = queuedFollowUps.find((item) => item.id === editingItem?.id);\n const createNew = Boolean(editingItem && !savedItem);\n const stale = Boolean(\n editingItem && savedItem && editingItem.revision && editingItem.revision !== savedItem.revision,\n );\n const inputValue = editingItem ? (edits[editingItem.id]?.text ?? editingItem.prompt) : defaultValue;\n const savedDraftState = draftState?.text === defaultValue ? draftState.state : undefined;\n const editorState = editingItem ? edits[editingItem.id]?.state : savedDraftState;\n const select = (item: QueuedFollowUp | null) => {\n setEditingItem(item);\n setError(null);\n setNotice(null);\n onSelect?.(item);\n setFocusSignal((signal) => signal + 1);\n };\n useEffect(() => {\n if (!editingItem || savedItem || updating || disabled || recoveredItemId === editingItem.id) return;\n setRecoveredItemId(editingItem.id);\n if (!canRestoreDraft || !onChange || defaultValue.trim() || queuedFollowUps.length) return;\n // The host moves settings and files before the editor gives the draft its text.\n onRestoreDraft?.(editingItem.id);\n setDraftState({ text: inputValue, state: editorState ?? createSerializedPromptState(inputValue) });\n setSelections((current) => ({ ...current, draft: current[editingItem.id] }));\n onChange(inputValue);\n setEdits((current) => {\n const next = { ...current };\n delete next[editingItem.id];\n return next;\n });\n setEditingItem(null);\n setError(null);\n onSelect?.(null);\n setFocusSignal((signal) => signal + 1);\n setNotice(\"This request was sent. Your edit moved to the draft.\");\n }, [\n editingItem,\n savedItem,\n updating,\n disabled,\n recoveredItemId,\n canRestoreDraft,\n defaultValue,\n queuedFollowUps.length,\n onRestoreDraft,\n inputValue,\n editorState,\n onChange,\n onSelect,\n ]);\n const change = (text: string) => {\n if (!editingItem) {\n if (text !== defaultValue) setNotice(null);\n onChange?.(text);\n return;\n }\n setEdits((current) => ({ ...current, [editingItem.id]: { text, state: createSerializedPromptState(text) } }));\n };\n const changeState = (text: string, state: string) => {\n if (!editingItem) {\n setDraftState({ text, state });\n return;\n }\n setEdits((current) => ({ ...current, [editingItem.id]: { text, state } }));\n };\n const discard = () => {\n if (editingItem) {\n onDiscard?.(editingItem.id);\n setEdits((current) => {\n const next = { ...current };\n delete next[editingItem.id];\n return next;\n });\n }\n select(null);\n };\n const submit = async (text: string, attachments: string[], questionResponse?: ChatInputQuestionResponse) => {\n if (questionResponse) return onSubmit?.(text, attachments, questionResponse);\n if (!editingItem) return onSubmit?.(text, attachments);\n if (stale || updating) throw new Error(\"Select the saved request again before updating.\");\n setUpdating(true);\n try {\n if (createNew) {\n if (!onCreate) throw new Error(\"This conversation cannot create a new queue item.\");\n await onCreate(editingItem.id, text);\n } else await onUpdate?.(editingItem.id, text);\n setEdits((current) => {\n const next = { ...current };\n delete next[editingItem.id];\n return next;\n });\n select(null);\n } catch (failure) {\n setError(failure instanceof Error ? failure.message : \"Could not update. Your edit is kept.\");\n throw failure;\n } finally {\n setUpdating(false);\n }\n };\n const selectionKey = editingItem?.id ?? \"draft\";\n return {\n initialSelection: selections[selectionKey],\n changeSelection: (selection: PromptSelectionSnapshot) =>\n setSelections((current) => ({ ...current, [selectionKey]: selection })),\n draftValue: defaultValue,\n change,\n changeState,\n edit: (item: QueuedFollowUp) => {\n if (!updating) select(item);\n },\n selectDraft: () => {\n if (!updating) select(null);\n },\n discard,\n editingItem,\n editingItemId: editingItem?.id ?? null,\n focusSignal,\n inputValue,\n editorState,\n isEditing: Boolean(editingItem),\n submit,\n error,\n notice: notice ?? (createNew ? \"This request was sent. Create a new queue item to keep your edits.\" : null),\n createNew,\n updating,\n stale,\n dirtyItemIds: Object.keys(edits).filter(\n (id) => edits[id].text !== queuedFollowUps.find((item) => item.id === id)?.prompt,\n ),\n };\n};\n","import { Box, Button, Text } from \"@chakra-ui/react\";\nimport { createSerializedPromptState } from \"../utils/editor-state\";\nimport { ChatInput } from \"./chat-input\";\nimport type { ChatPanelComposerProps } from \"./chat-panel-composer\";\n\ninterface QueuedComposerInputProps extends ChatPanelComposerProps {\n editing: boolean;\n hasQueuedFollowUps: boolean;\n}\nexport const QueuedComposerInput = (props: QueuedComposerInputProps) => {\n const {\n conversationKey,\n recentUserMessages,\n actions,\n attachmentActions,\n attachedResources,\n attachmentList,\n chatInputAutoFocus,\n chatInputPlaceholder,\n chatInputQuestionPrompt,\n composerDecision,\n chatInputCommands,\n inputDisabled,\n submitDisabled,\n onAttachFiles,\n onAttachText,\n onClearAttachments,\n onInterrupt,\n queuedComposer,\n streaming,\n } = props;\n const { editing, hasQueuedFollowUps } = props;\n const actionLabel = queuedComposer.createNew ? \"Create new queue item\" : \"Update\";\n const updateLabel = queuedComposer.updating ? \"Saving…\" : actionLabel;\n return (\n <Box\n onKeyDown={(event) => {\n if (\n event.key !== \"Escape\" ||\n event.defaultPrevented ||\n event.nativeEvent.isComposing ||\n !editing ||\n inputDisabled ||\n queuedComposer.updating ||\n !event.currentTarget.contains(event.target as Node)\n )\n return;\n event.preventDefault();\n event.stopPropagation();\n queuedComposer.discard();\n }}\n >\n <ChatInput\n key={`${conversationKey ?? \"\"}:${queuedComposer.editingItemId ?? \"draft\"}`}\n recentUserMessages={recentUserMessages}\n placeholder={chatInputPlaceholder}\n defaultState={queuedComposer.editorState ?? createSerializedPromptState(queuedComposer.inputValue)}\n streaming={editing ? false : streaming}\n onSubmit={queuedComposer.submit}\n onInterrupt={editing ? undefined : onInterrupt}\n onAttachFiles={onAttachFiles}\n onAttachText={onAttachText}\n onChange={queuedComposer.change}\n onEditorStateChange={queuedComposer.changeState}\n initialSelection={queuedComposer.initialSelection}\n onSelectionChange={queuedComposer.changeSelection}\n actions={actions}\n submitActions={\n editing ? (\n <Button\n size=\"xs\"\n variant=\"ghost\"\n onClick={queuedComposer.discard}\n disabled={queuedComposer.updating || inputDisabled}\n >\n Cancel\n </Button>\n ) : null\n }\n attachmentActions={attachmentActions}\n attachedResources={attachedResources}\n onClearAttachments={onClearAttachments}\n attachmentList={attachmentList}\n isDisabled={inputDisabled || queuedComposer.updating}\n submitDisabled={submitDisabled || (editing && queuedComposer.stale)}\n attachedToTop={!editing && hasQueuedFollowUps}\n questionPrompt={chatInputQuestionPrompt}\n decision={composerDecision}\n autoFocus={chatInputAutoFocus}\n focusSignal={queuedComposer.focusSignal}\n submitTitle={editing ? actionLabel : undefined}\n submitLabel={editing ? updateLabel : undefined}\n retainTextUntilAcknowledged={editing}\n commands={chatInputCommands}\n />\n <QueuedComposerNotice queuedComposer={queuedComposer} editing={editing} />\n </Box>\n );\n};\n\nconst QueuedComposerNotice = (props: Pick<QueuedComposerInputProps, \"queuedComposer\" | \"editing\">) => {\n const { queuedComposer, editing } = props;\n const stale = editing && queuedComposer.stale;\n const notice =\n queuedComposer.error ??\n (stale\n ? \"This request changed. Your edit is kept; select the saved request again before updating.\"\n : queuedComposer.notice);\n if (!notice) return null;\n const failure = Boolean(queuedComposer.error || stale);\n return (\n <Text\n mt=\"2xs\"\n color={failure ? \"fg.error\" : \"fg.muted\"}\n textStyle=\"label/S/regular\"\n role={failure ? \"alert\" : \"status\"}\n aria-label=\"Queued edit notice\"\n >\n {notice}\n </Text>\n );\n};\n","import { Box, Text, useSlotRecipe } from \"@chakra-ui/react\";\nimport { type KeyboardCoordinateGetter, useDroppable } from \"@dnd-kit/core\";\nimport { ArrowUp } from \"lucide-react\";\nimport { queuedFollowUpRecipe } from \"@/theme/recipes/queued-follow-up\";\nimport type { QueuedFollowUp } from \"./message-types\";\n\nexport const queueKeyboardCoordinates = (\n event: KeyboardEvent,\n { context }: Parameters<KeyboardCoordinateGetter>[1],\n onTarget?: (id: string | number) => void,\n) => {\n const keys = [\"ArrowUp\", \"ArrowDown\", \"Home\", \"End\"];\n if (!keys.includes(event.code)) return undefined;\n event.preventDefault();\n const targets = context.droppableContainers\n .getEnabled()\n .sort((a, b) => Number(a.data.current?.order) - Number(b.data.current?.order));\n const index = targets.findIndex((target) => target.id === context.over?.id);\n let next = index + (event.code === \"ArrowUp\" ? -1 : 1);\n if (event.code === \"Home\") next = 0;\n if (event.code === \"End\") next = targets.length - 1;\n const target = targets[Math.max(0, Math.min(targets.length - 1, next))];\n const rect = target && context.droppableRects.get(target.id);\n if (!rect) return undefined;\n onTarget?.(target.id);\n return {\n x: rect.left + (rect.width - (context.collisionRect?.width ?? 0)) / 2,\n y: rect.top + (rect.height - (context.collisionRect?.height ?? 0)) / 2,\n };\n};\n\nexport const QueueDropZone = (props: { item: QueuedFollowUp; index: number; kind: \"before\" | \"combine\" | \"after\" }) => {\n const { item, index, kind } = props;\n const drop = useDroppable({\n id: `${item.id}:${kind}`,\n disabled: Boolean(item.sending || item.steeringDelivery),\n data: { item, kind, order: index * 3 + [\"before\", \"combine\", \"after\"].indexOf(kind) },\n });\n const position = {\n before: { top: \"0\", height: \"25%\" },\n combine: { top: \"25%\", height: \"50%\" },\n after: { bottom: \"0\", height: \"25%\" },\n }[kind];\n return <Box ref={drop.setNodeRef} position=\"absolute\" insetX=\"0\" pointerEvents=\"none\" {...position} />;\n};\n\nexport const QueueSendNow = (props: { visible: boolean; targeted: boolean; reason?: string | null }) => {\n const { visible, targeted, reason } = props;\n const drop = useDroppable({ id: \"queue-send-now\", disabled: !visible, data: { kind: \"steer\", order: -1 } });\n const styles = useSlotRecipe({ recipe: queuedFollowUpRecipe })();\n if (!visible) return null;\n return (\n <Box ref={drop.setNodeRef} css={styles.sendNowHit}>\n <Box\n css={styles.sendNow}\n bottom=\"0\"\n title={reason ?? undefined}\n aria-disabled={Boolean(reason)}\n data-targeted={targeted && !reason}\n data-queue-send-now\n >\n <ArrowUp size={14} />\n <Text>{\"drop here to send now\"}</Text>\n </Box>\n </Box>\n );\n};\n","import { Box, HStack, IconButton, Stack, Text, useSlotRecipe } from \"@chakra-ui/react\";\nimport { useDraggable } from \"@dnd-kit/core\";\nimport { GripVertical, Trash2 } from \"lucide-react\";\nimport { type ReactNode, useEffect, useRef, useState } from \"react\";\nimport { DropIndicator } from \"@/components/primitives/drop-indicator\";\nimport { queuedFollowUpRecipe } from \"@/theme/recipes/queued-follow-up\";\nimport type { QueuedFollowUp } from \"./message-types\";\nimport { QueueDropZone } from \"./queued-follow-up-drag\";\n\ninterface QueuedFollowUpRowProps {\n item: QueuedFollowUp;\n index: number;\n editor?: ReactNode;\n source: boolean;\n destination?: string;\n unavailableReason?: string | null;\n editing: boolean;\n onEdit?: (item: QueuedFollowUp) => void;\n onRemove?: (id: string) => void;\n}\nexport const QueuedFollowUpRow = (props: QueuedFollowUpRowProps) => {\n const { item, index, editor, source, destination, unavailableReason, editing, onEdit, onRemove } = props;\n const disabled = Boolean(item.sending || item.steeringDelivery);\n const drag = useDraggable({ id: item.id, data: { item }, disabled });\n const styles = useSlotRecipe({ recipe: queuedFollowUpRecipe })();\n const [hovered, setHovered] = useState(false);\n const [focused, setFocused] = useState(false);\n const exit = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const row = useRef<HTMLDivElement | null>(null);\n useEffect(() => () => clearTimeout(exit.current), []);\n useEffect(() => {\n if (editing) row.current?.scrollIntoView({ block: \"nearest\" });\n }, [editing]);\n const reveal = () => {\n clearTimeout(exit.current);\n setHovered(true);\n };\n const compact = !editor;\n return (\n <Box\n className=\"group\"\n ref={(node: HTMLDivElement | null) => {\n drag.setNodeRef(node);\n row.current = node;\n }}\n css={styles.row}\n data-drag-source={source}\n data-combine-target={destination === \"combine\" && !unavailableReason}\n data-queued-follow-up-id={item.id}\n aria-busy={item.sending || undefined}\n onPointerEnter={reveal}\n onPointerLeave={() => {\n exit.current = setTimeout(() => setHovered(false), 150);\n }}\n onPointerDown={(event) => {\n if (event.pointerType === \"touch\") reveal();\n }}\n onFocusCapture={() => setFocused(true)}\n onBlurCapture={(event) => {\n if (!event.currentTarget.contains(event.relatedTarget)) setFocused(false);\n }}\n onClick={(event) => {\n if (!item.sending && compact && !(event.target as Element).closest(\"button\")) onEdit?.(item);\n }}\n >\n <IconButton\n ref={drag.setActivatorNodeRef}\n {...drag.listeners}\n {...drag.attributes}\n aria-label={`Drag queued follow-up ${index + 1}`}\n size=\"2xs\"\n variant=\"ghost\"\n css={styles.handle}\n disabled={disabled}\n onClick={(event) => event.stopPropagation()}\n >\n <GripVertical size={14} />\n </IconButton>\n <Stack flex=\"1\" minW=\"0\" gap=\"2xs\">\n {editor ?? (\n <Box asChild css={styles.content}>\n <button\n type=\"button\"\n disabled={item.sending}\n aria-label={`Edit queued message: ${item.prompt}`}\n onClick={() => onEdit?.(item)}\n >\n <Text lineClamp={2}>{item.prompt}</Text>\n <Text color=\"fg.muted\" textStyle=\"label/XS\" lineClamp={1}>\n {destination === \"combine\"\n ? (unavailableReason ?? \"Release to combine\")\n : [\n item.sending ? \"Sending…\" : null,\n item.model,\n ...Object.values(item.params ?? {}).map(String),\n ...(item.attachments?.map((attachment) => attachment.name) ?? []),\n ]\n .filter(Boolean)\n .join(\" · \") || \"Saved request\"}\n </Text>\n </button>\n </Box>\n )}\n {item.steeringDelivery ? (\n <Text css={styles.notice}>Delivery is unconfirmed. Saved input is kept and will not be replayed.</Text>\n ) : null}\n </Stack>\n {onRemove && !editor && !disabled ? (\n <HStack css={styles.actions} data-visible={hovered || focused || editing}>\n <IconButton\n aria-label=\"Remove queued follow-up\"\n size=\"2xs\"\n variant=\"destructive-ghost\"\n onClick={(event) => {\n event.stopPropagation();\n onRemove(item.id);\n }}\n >\n <Trash2 size={14} />\n </IconButton>\n </HStack>\n ) : null}\n <QueueDropZone item={item} index={index} kind=\"before\" />\n <QueueDropZone item={item} index={index} kind=\"combine\" />\n <QueueDropZone item={item} index={index} kind=\"after\" />\n {destination === \"before\" ? <DropIndicator top=\"0\" /> : null}\n {destination === \"after\" ? <DropIndicator bottom=\"0\" /> : null}\n </Box>\n );\n};\n","import { Box, Text, useSlotRecipe } from \"@chakra-ui/react\";\nimport {\n DndContext,\n KeyboardSensor,\n PointerSensor,\n pointerWithin,\n rectIntersection,\n useSensor,\n useSensors,\n} from \"@dnd-kit/core\";\nimport { Fragment, type ReactNode, useState } from \"react\";\nimport { ScrollArea } from \"@/components/primitives/scroll-area\";\nimport { queuedFollowUpRecipe } from \"@/theme/recipes/queued-follow-up\";\nimport type { QueuedFollowUp } from \"./message-types\";\nimport { QueueSendNow, queueKeyboardCoordinates } from \"./queued-follow-up-drag\";\nimport type { QueuedFollowUpMoveDirection } from \"./queued-follow-up-list-state\";\nimport { QueuedFollowUpRow } from \"./queued-follow-up-row\";\n\ninterface QueuedFollowUpListProps {\n items: QueuedFollowUp[];\n editingItemId?: string | null;\n editor?: ReactNode;\n retainedEditor?: ReactNode;\n retainedEditorPosition?: number;\n dirtyItemIds?: string[];\n steeringUnavailableReason?: string | null;\n onEdit?: (item: QueuedFollowUp) => void;\n onRemove?: (itemId: string) => void;\n onMove?: (\n itemId: string,\n direction: QueuedFollowUpMoveDirection,\n steps?: number,\n selection?: { source: QueuedFollowUp; items: QueuedFollowUp[] },\n ) => void | Promise<void>;\n onSteer?: (item: QueuedFollowUp) => void | Promise<void>;\n onCombine?: (source: QueuedFollowUp, target: QueuedFollowUp) => void | Promise<void>;\n}\nconst settingsKey = (item: QueuedFollowUp) =>\n JSON.stringify([item.model, Object.entries(item.params ?? {}).sort(([a], [b]) => a.localeCompare(b))]);\nexport const QueuedFollowUpList = (props: QueuedFollowUpListProps) => {\n const {\n items,\n editingItemId,\n editor,\n retainedEditor,\n retainedEditorPosition,\n dirtyItemIds = [],\n steeringUnavailableReason,\n onEdit,\n onRemove,\n onMove,\n onSteer,\n onCombine,\n } = props;\n const styles = useSlotRecipe({ recipe: queuedFollowUpRecipe })();\n const [keyboardTarget, setKeyboardTarget] = useState<string | number | null>(null);\n const sensors = useSensors(\n useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),\n useSensor(KeyboardSensor, {\n coordinateGetter: (event, context) => queueKeyboardCoordinates(event, context, setKeyboardTarget),\n }),\n );\n const [source, setSource] = useState<QueuedFollowUp | null>(null);\n const [dragItems, setDragItems] = useState<QueuedFollowUp[]>([]);\n const [destination, setDestination] = useState<{ kind: string; item?: QueuedFollowUp } | null>(null);\n const [error, setError] = useState<string | null>(null);\n const [pending, setPending] = useState(false);\n if (!items.length && !retainedEditor) return null;\n const retainedIndex = getRetainedEditorIndex(items, retainedEditorPosition);\n const steerReason =\n source?.steeringUnavailableReason ??\n steeringUnavailableReason ??\n (source && dirtyItemIds.includes(source.id) ? \"Update or Cancel this edit before sending.\" : null) ??\n (onSteer ? null : \"This conversation cannot accept live input.\");\n const showSendNow = Boolean(source && onSteer && !steeringUnavailableReason);\n const combineReason = (target: QueuedFollowUp) => {\n if (!source || source.id === target.id) return \"Choose another request.\";\n if (dirtyItemIds.includes(source.id) || dirtyItemIds.includes(target.id))\n return \"Update or Cancel the edits first.\";\n if (settingsKey(source) !== settingsKey(target)) return \"Model and thinking settings must match.\";\n if (target.steeringDelivery) return \"Delivery is still being confirmed.\";\n return null;\n };\n const reorder = (selected: QueuedFollowUp, target: QueuedFollowUp, kind: string) => {\n const eligible = dragItems.filter((item) => !item.sending && !item.steeringDelivery);\n const start = eligible.findIndex((item) => item.id === selected.id);\n const end = eligible.findIndex((item) => item.id === target.id);\n if (start < 0 || end < 0 || start === end) return;\n const insertion = end + (kind === \"after\" ? 1 : 0);\n const next = insertion - (start < insertion ? 1 : 0);\n if (next === start) return;\n return onMove?.(selected.id, next < start ? \"up\" : \"down\", Math.abs(next - start), {\n source: selected,\n items: dragItems,\n });\n };\n const performDrop = (selected: QueuedFollowUp, target: { kind: string; item?: QueuedFollowUp }) => {\n if (target.kind === \"steer\") {\n if (!steerReason) return onSteer?.(selected);\n setError(steerReason);\n return;\n }\n if (!target.item) return;\n if (target.kind === \"combine\") {\n if (!combineReason(target.item)) return onCombine?.(selected, target.item);\n return;\n }\n return reorder(selected, target.item, target.kind);\n };\n return (\n <DndContext\n sensors={sensors}\n collisionDetection={(args) => {\n if (!args.pointerCoordinates && keyboardTarget !== null) return [{ id: keyboardTarget }];\n const pointer = pointerWithin(args);\n return pointer.length ? pointer : rectIntersection(args);\n }}\n autoScroll\n onDragStart={(event) => {\n setKeyboardTarget(null);\n setSource(event.active.data.current?.item ?? null);\n setDragItems(items);\n setError(null);\n }}\n onDragOver={(event) =>\n setDestination((event.over?.data.current as { kind: string; item?: QueuedFollowUp }) ?? null)\n }\n onDragCancel={() => {\n setKeyboardTarget(null);\n setSource(null);\n setDestination(null);\n }}\n onDragEnd={(event) => {\n const selected = source;\n const target = event.over?.data.current;\n setSource(null);\n setDestination(null);\n if (!selected || !target || pending) return;\n setPending(true);\n void Promise.resolve()\n .then(() => performDrop(selected, target as { kind: string; item?: QueuedFollowUp }))\n .catch((failure) =>\n setError(failure instanceof Error ? failure.message : \"Could not change the queue. Saved input is kept.\"),\n )\n .finally(() => setPending(false));\n }}\n >\n <Box css={styles.root} data-send-now-visible={showSendNow} aria-busy={pending}>\n <QueueSendNow visible={showSendNow} targeted={destination?.kind === \"steer\"} reason={steerReason} />\n <ScrollArea maxH=\"queue-viewport\" minH=\"0\" viewportProps={{ maxH: \"queue-viewport\" }}>\n {items.map((item, index) => (\n <Fragment key={item.id}>\n {retainedEditor && index === retainedIndex ? <RetainedEditor>{retainedEditor}</RetainedEditor> : null}\n <QueuedFollowUpRow\n item={item}\n index={index}\n source={source?.id === item.id}\n destination={destination?.item?.id === item.id ? destination.kind : undefined}\n unavailableReason={destination?.kind === \"combine\" ? combineReason(item) : null}\n editing={editingItemId === item.id}\n editor={editingItemId === item.id ? editor : undefined}\n onEdit={onEdit}\n onRemove={onRemove}\n />\n </Fragment>\n ))}\n {retainedEditor && retainedIndex === items.length ? <RetainedEditor>{retainedEditor}</RetainedEditor> : null}\n </ScrollArea>\n {error ? (\n <Text css={styles.notice} role=\"alert\">\n {error}\n </Text>\n ) : null}\n </Box>\n </DndContext>\n );\n};\n\nconst getRetainedEditorIndex = (items: QueuedFollowUp[], position = Number.POSITIVE_INFINITY) => {\n const index = items.findIndex((item) => (item.position ?? Number.POSITIVE_INFINITY) > position);\n return index < 0 ? items.length : index;\n};\n\nconst RetainedEditor = (props: { children: ReactNode }) => {\n const { children } = props;\n const styles = useSlotRecipe({ recipe: queuedFollowUpRecipe })();\n return (\n <Box css={styles.row}>\n <Box flex=\"1\" minW=\"0\">\n {children}\n </Box>\n </Box>\n );\n};\n","import { Box, Stack, useSlotRecipe } from \"@chakra-ui/react\";\nimport type { ReactNode } from \"react\";\nimport { chatComposerRecipe } from \"@/theme/recipes/chat-composer\";\nimport { queuedFollowUpRecipe } from \"@/theme/recipes/queued-follow-up\";\nimport type { useQueuedFollowUpComposer } from \"./use-queued-follow-up-composer\";\n\nexport { useQueuedFollowUpComposer } from \"./use-queued-follow-up-composer\";\n\nimport type { PromptCommand } from \"@/components/rich-text\";\nimport type { ChatInputQuestionPrompt } from \"./chat-input-question-prompt\";\nimport type { ComposerDecision } from \"./composer-decision\";\nimport type { QueuedFollowUp } from \"./message-types\";\nimport { QueuedComposerInput } from \"./queued-composer-input\";\nimport { QueuedFollowUpList } from \"./queued-follow-up-list\";\nimport type { QueuedFollowUpMoveDirection } from \"./queued-follow-up-list-state\";\n\nexport interface ChatPanelComposerProps {\n conversationKey?: string;\n recentUserMessages: string[];\n actions?: ReactNode;\n /** Attachment controls shown only while editing a message draft. */\n attachmentActions?: ReactNode;\n composerHeader?: ReactNode;\n attachedResources?: string[];\n attachmentList?: ReactNode;\n chatInputAutoFocus: boolean;\n chatInputPlaceholder: string;\n chatInputQuestionPrompt?: ChatInputQuestionPrompt;\n composerDecision?: ComposerDecision;\n chatInputCommands: PromptCommand[];\n hasWorkspaceHub: boolean;\n inputDisabled: boolean;\n submitDisabled: boolean;\n onAttachFiles?: (files: File[]) => void;\n onAttachText?: (text: string) => void;\n onClearAttachments?: () => void;\n onInterrupt?: () => void;\n onQueuedFollowUpMove?: (\n itemId: string,\n direction: QueuedFollowUpMoveDirection,\n steps?: number,\n selection?: { source: QueuedFollowUp; items: QueuedFollowUp[] },\n ) => void;\n onQueuedFollowUpRemove?: (itemId: string) => void;\n onQueuedFollowUpUpdate?: (itemId: string, prompt: string) => void | Promise<void>;\n onQueuedFollowUpSteer?: (item: QueuedFollowUp) => void | Promise<void>;\n onQueuedFollowUpCombine?: (source: QueuedFollowUp, target: QueuedFollowUp) => void | Promise<void>;\n queueSteeringUnavailableReason?: string | null;\n unsavedQueueItemIds?: string[];\n queuedComposer: ReturnType<typeof useQueuedFollowUpComposer>;\n queuedFollowUps: QueuedFollowUp[];\n streaming: boolean;\n workspaceHub?: ReactNode;\n}\n\nexport const ChatPanelComposer = (props: ChatPanelComposerProps) => {\n const {\n composerHeader,\n chatInputQuestionPrompt,\n composerDecision,\n hasWorkspaceHub,\n onQueuedFollowUpMove,\n onQueuedFollowUpRemove,\n onQueuedFollowUpUpdate,\n onQueuedFollowUpSteer,\n onQueuedFollowUpCombine,\n queueSteeringUnavailableReason,\n unsavedQueueItemIds = [],\n queuedComposer,\n queuedFollowUps,\n workspaceHub,\n } = props;\n const styles = useSlotRecipe({ recipe: queuedFollowUpRecipe })();\n const composerStyles = useSlotRecipe({ recipe: chatComposerRecipe })({ workspace: hasWorkspaceHub });\n const hasQueuedFollowUps = queuedFollowUps.length > 0;\n\n const editing = queuedComposer.isEditing && !chatInputQuestionPrompt && !composerDecision;\n const editor = <QueuedComposerInput {...props} editing={editing} hasQueuedFollowUps={hasQueuedFollowUps} />;\n return (\n <Stack p=\"xs\" gap=\"0\">\n <Box className=\"ps-chat-composer__workspace\" css={composerStyles.workspace}>\n {workspaceHub}\n {composerHeader}\n <QueuedFollowUpList\n items={queuedFollowUps}\n editor={editing ? editor : undefined}\n retainedEditor={editing && queuedComposer.createNew ? editor : undefined}\n retainedEditorPosition={queuedComposer.editingItem?.position}\n dirtyItemIds={[...queuedComposer.dirtyItemIds, ...unsavedQueueItemIds]}\n steeringUnavailableReason={queueSteeringUnavailableReason}\n onSteer={onQueuedFollowUpSteer}\n onCombine={onQueuedFollowUpCombine}\n editingItemId={queuedComposer.editingItemId}\n onEdit={onQueuedFollowUpUpdate ? queuedComposer.edit : undefined}\n onRemove={onQueuedFollowUpRemove}\n onMove={onQueuedFollowUpMove}\n />\n {editing ? (\n <Box css={styles.draft} asChild>\n <button type=\"button\" onClick={queuedComposer.selectDraft} aria-label=\"Edit saved draft\">\n {queuedComposer.draftValue || \"Saved draft · select to edit\"}\n </button>\n </Box>\n ) : (\n editor\n )}\n </Box>\n </Stack>\n );\n};\n","import { HStack, Spinner, Text } from \"@chakra-ui/react\";\nimport { useEffect, useState } from \"react\";\n\n// Compact, unit-dropping elapsed format: \"4s\", \"48s\", \"10m 20s\", \"1h 04m\".\nconst formatElapsed = (totalSeconds: number) => {\n const seconds = Math.max(0, Math.floor(totalSeconds));\n if (seconds < 60) return `${seconds}s`;\n\n const minutes = Math.floor(seconds / 60);\n if (minutes < 60) return `${minutes}m ${String(seconds % 60).padStart(2, \"0\")}s`;\n\n const hours = Math.floor(minutes / 60);\n return `${hours}h ${String(minutes % 60).padStart(2, \"0\")}m`;\n};\n\n/**\n * Working indicator: a spinner followed by the elapsed run time in mono digits — never a\n * static \"Working…\" label. The elapsed time is the one thing a static label cannot tell you\n * and how you judge whether a run is stuck. Counts from the start of the active stream, including\n * time spent temporarily hidden while the workspace initializes.\n */\nexport const WorkingIndicator = (props: { startedAt?: number; hidden?: boolean }) => {\n const { startedAt, hidden = false } = props;\n const [mountedAt] = useState(Date.now);\n const [now, setNow] = useState(Date.now);\n\n useEffect(() => {\n if (hidden) return;\n\n const updateElapsed = () => setNow(Date.now());\n updateElapsed();\n const timer = setInterval(updateElapsed, 1000);\n return () => clearInterval(timer);\n }, [hidden]);\n\n if (hidden) return null;\n\n return (\n <HStack gap=\"2xs\" px=\"sm\" py=\"xs\">\n <Spinner size=\"xs\" color=\"fg.muted\" />\n <Text fontFamily=\"mono\" fontSize=\"xs\" color=\"fg.muted\" letterSpacing=\"-0.2px\">\n {formatElapsed((now - (startedAt ?? mountedAt)) / 1000)}\n </Text>\n </HStack>\n );\n};\n","import { Box, Flex } from \"@chakra-ui/react\";\nimport { MessageCircleIcon } from \"lucide-react\";\nimport { type ReactNode, useState } from \"react\";\nimport { EmptyState } from \"@/components/primitives/empty-state\";\nimport type { PromptCommand } from \"@/components/rich-text\";\nimport { ChatImageHistoryContext, indexChatImageSources } from \"../links/chat-image-sources\";\nimport type { ChatLinkProps } from \"../links/chat-link\";\nimport { ChatLinkProvider } from \"../links/chat-link-context\";\nimport { resolveActiveQuestionPrompt } from \"../tool-rendering/question-prompt\";\nimport { ChatPrimitives } from \"./ai-conversation\";\nimport { AutoScroll } from \"./auto-scroll\";\nimport { getRecentUserPrompts } from \"./chat-input-history\";\nimport type { ChatInputQuestionPrompt, ChatInputQuestionResponse } from \"./chat-input-question-prompt\";\nimport { ChatMessageList } from \"./chat-message-list\";\nimport { ChatPanelComposer, useQueuedFollowUpComposer } from \"./chat-panel-composer\";\nimport { ChatQuestionNavigationContext, useChatQuestionNavigation } from \"./chat-question-navigation\";\nimport type { ComposerDecision } from \"./composer-decision\";\nimport {\n groupMessagesByTurn,\n normalizeChatMessagesForDisplay,\n type QueuedFollowUp,\n type SessionMessage,\n} from \"./message-types\";\nimport type { QueuedFollowUpMoveDirection } from \"./queued-follow-up-list-state\";\nimport { WorkingIndicator } from \"./working-indicator\";\n\n/** Full conversation shell for agent sessions, including messages, input, attachments, and host-provided slots. */\nexport interface ChatPanelProps extends ChatLinkProps {\n /** Stable conversation identity used to reset ready state when switching sessions. */\n conversationKey?: string;\n messages: SessionMessage[];\n loading?: boolean;\n streaming?: boolean;\n /** Current run start in milliseconds. Without an anchor, elapsed time starts when streaming mounts. */\n streamingStartedAt?: number;\n emptyStateTitle: string;\n emptyStateDescription: string;\n emptyStateContent?: ReactNode;\n loaderComponent?: ReactNode;\n chatInputPlaceholder: string;\n chatInputDefaultValue?: string;\n onSubmitMessage?: (\n text: string,\n attachments: string[],\n questionResponse?: ChatInputQuestionResponse,\n ) => void | Promise<void>;\n onInterrupt?: () => void;\n onAttachFiles?: (files: File[]) => void;\n onAttachText?: (text: string) => void;\n onChatInputChange?: (text: string) => void;\n /** Controls shared by the message and question toolbars (model, params). */\n actions?: ReactNode;\n /** Attachment controls shown only while editing a message draft. */\n attachmentActions?: ReactNode;\n composerHeader?: ReactNode;\n attachedResources?: string[];\n onClearAttachments?: () => void;\n attachmentList?: ReactNode;\n approvalPrompt?: ReactNode;\n /** Problems shown at the end of the conversation, such as a failed load or a message that was not sent. Without messages, they appear above the empty state. */\n conversationNotices?: ReactNode;\n /** Optional workspace status/control surface rendered above the conversation viewport. */\n workspaceHub?: ReactNode;\n workspaceInitializing?: boolean;\n inputDisabled?: boolean;\n /** Blocks sending while the editor stays usable, for example while no model is selected. */\n submitDisabled?: boolean;\n chatInputQuestionPrompt?: ChatInputQuestionPrompt;\n composerDecision?: ComposerDecision;\n chatInputAutoFocus?: boolean;\n queuedFollowUps?: QueuedFollowUp[];\n onQueuedFollowUpUpdate?: (itemId: string, prompt: string) => void | Promise<void>;\n /** Submit the retained edit's settings and files as a new request. */\n onQueuedFollowUpCreate?: (itemId: string, prompt: string) => void | Promise<void>;\n /** Move the retained edit's settings and files into the normal draft before its text changes. */\n onQueuedFollowUpRestoreDraft?: (itemId: string) => void;\n /** Allow recovery only when the normal draft has no files or uploads and the host can transfer the edit. */\n canRestoreQueuedEditToDraft?: boolean;\n onQueuedFollowUpSelect?: (item: QueuedFollowUp | null) => void;\n onQueuedFollowUpDiscard?: (itemId: string) => void;\n onQueuedFollowUpSteer?: (item: QueuedFollowUp) => void | Promise<void>;\n onQueuedFollowUpCombine?: (source: QueuedFollowUp, target: QueuedFollowUp) => void | Promise<void>;\n queueSteeringUnavailableReason?: string | null;\n unsavedQueueItemIds?: string[];\n\n onQueuedFollowUpRemove?: (itemId: string) => void;\n onQueuedFollowUpMove?: (\n itemId: string,\n direction: QueuedFollowUpMoveDirection,\n steps?: number,\n selection?: { source: QueuedFollowUp; items: QueuedFollowUp[] },\n ) => void;\n chatInputCommands?: PromptCommand[];\n}\n\nexport const ChatPanel = (props: ChatPanelProps) => {\n const {\n conversationKey,\n linkHandler,\n messages,\n loading = false,\n streaming = false,\n streamingStartedAt,\n emptyStateTitle,\n emptyStateDescription,\n emptyStateContent,\n loaderComponent,\n chatInputPlaceholder,\n chatInputDefaultValue = \"\",\n onSubmitMessage,\n onInterrupt,\n onAttachFiles,\n onAttachText,\n onChatInputChange,\n actions,\n attachmentActions,\n composerHeader,\n attachedResources,\n onClearAttachments,\n attachmentList,\n approvalPrompt,\n conversationNotices,\n workspaceHub,\n workspaceInitializing = false,\n inputDisabled = false,\n submitDisabled = false,\n chatInputQuestionPrompt,\n composerDecision,\n chatInputAutoFocus = false,\n queuedFollowUps = [],\n onQueuedFollowUpUpdate,\n onQueuedFollowUpCreate,\n onQueuedFollowUpRestoreDraft,\n canRestoreQueuedEditToDraft,\n onQueuedFollowUpSelect,\n onQueuedFollowUpDiscard,\n onQueuedFollowUpSteer,\n onQueuedFollowUpCombine,\n queueSteeringUnavailableReason,\n unsavedQueueItemIds,\n onQueuedFollowUpRemove,\n onQueuedFollowUpMove,\n chatInputCommands = [],\n } = props;\n\n const merged = normalizeChatMessagesForDisplay(messages, { streaming });\n const hasMessages = merged.length > 0;\n const messageListKey = conversationKey ?? merged[0]?.id;\n const messageListIdentity = hasMessages ? (messageListKey ?? \"active-conversation\") : null;\n const userMessageCount = merged.reduce((count, message) => count + (message.role === \"user\" ? 1 : 0), 0);\n const { groups, leadingResponses } = groupMessagesByTurn(merged);\n const [expandedStickyMessageIds, setExpandedStickyMessageIds] = useState(() => new Set<string>());\n const [readyMessageListKey, setReadyMessageListKey] = useState<string | null>(null);\n const showLoadingState = !hasMessages && loading;\n const defaultEmptyContent = (\n <EmptyState\n icon={<MessageCircleIcon size={48} strokeWidth={1.5} />}\n title={emptyStateTitle}\n description={emptyStateDescription}\n />\n );\n const emptyContent = showLoadingState ? loaderComponent : (emptyStateContent ?? defaultEmptyContent);\n const hasWorkspaceHub = Boolean(workspaceHub);\n const questionNavigation = useChatQuestionNavigation(messages, conversationKey ?? messages[0]?.id);\n const activeQuestionPrompt =\n questionNavigation.prompt ?? chatInputQuestionPrompt ?? resolveActiveQuestionPrompt(messages);\n const hideActiveQuestionForms = Boolean(activeQuestionPrompt);\n const showThinkingIndicator = streaming && hasMessages && !workspaceInitializing && !activeQuestionPrompt;\n const isMessageViewportReady = !messageListIdentity || readyMessageListKey === messageListIdentity;\n const queuedComposer = useQueuedFollowUpComposer({\n queuedFollowUps,\n defaultValue: chatInputDefaultValue,\n onChange: onChatInputChange,\n onSubmit: onSubmitMessage,\n onUpdate: onQueuedFollowUpUpdate,\n onCreate: onQueuedFollowUpCreate,\n onRestoreDraft: onQueuedFollowUpRestoreDraft,\n canRestoreDraft: canRestoreQueuedEditToDraft,\n disabled: inputDisabled,\n onSelect: onQueuedFollowUpSelect,\n onDiscard: onQueuedFollowUpDiscard,\n });\n\n const toggleStickyMessageExpanded = (messageId: string) => {\n setExpandedStickyMessageIds((current) => {\n const next = new Set(current);\n if (next.has(messageId)) {\n next.delete(messageId);\n } else {\n next.add(messageId);\n }\n\n return next;\n });\n };\n\n return (\n <ChatImageHistoryContext value={indexChatImageSources(messages, linkHandler)}>\n <ChatLinkProvider handler={linkHandler}>\n <ChatQuestionNavigationContext value={questionNavigation.value}>\n <Flex position=\"relative\" direction=\"column\" w=\"full\" h=\"full\" overflow=\"hidden\">\n <ChatPrimitives.Root key={messageListKey}>\n <AutoScroll conversationKey={messageListKey ?? null} userMessageCount={userMessageCount} />\n <ChatPrimitives.Viewport visibility={isMessageViewportReady ? \"visible\" : \"hidden\"}>\n {hasMessages ? (\n <>\n <ChatMessageList\n key={messageListIdentity}\n leadingResponses={leadingResponses}\n groups={groups}\n streaming={streaming}\n hideActiveQuestionForms={hideActiveQuestionForms}\n expandedStickyMessageIds={expandedStickyMessageIds}\n onToggleStickyMessage={toggleStickyMessageExpanded}\n onReady={() => setReadyMessageListKey(messageListIdentity)}\n />\n {conversationNotices}\n </>\n ) : (\n <>\n {conversationNotices}\n {emptyContent}\n </>\n )}\n </ChatPrimitives.Viewport>\n {isMessageViewportReady ? <ChatPrimitives.ScrollToBottom aria-label=\"Scroll to latest message\" /> : null}\n </ChatPrimitives.Root>\n <Box layerStyle=\"chatContent\" flexShrink=\"0\">\n {approvalPrompt}\n {streaming ? (\n <WorkingIndicator key={messageListKey} startedAt={streamingStartedAt} hidden={!showThinkingIndicator} />\n ) : null}\n <ChatPanelComposer\n conversationKey={conversationKey ?? messages[0]?.id}\n recentUserMessages={getRecentUserPrompts(messages)}\n actions={actions}\n attachmentActions={attachmentActions}\n composerHeader={composerHeader}\n attachedResources={attachedResources}\n attachmentList={attachmentList}\n chatInputAutoFocus={chatInputAutoFocus}\n chatInputPlaceholder={chatInputPlaceholder}\n chatInputQuestionPrompt={activeQuestionPrompt}\n composerDecision={questionNavigation.prompt ? undefined : composerDecision}\n chatInputCommands={chatInputCommands}\n hasWorkspaceHub={hasWorkspaceHub}\n inputDisabled={inputDisabled}\n submitDisabled={submitDisabled}\n onAttachFiles={onAttachFiles}\n onAttachText={onAttachText}\n onClearAttachments={onClearAttachments}\n onInterrupt={onInterrupt}\n onQueuedFollowUpMove={onQueuedFollowUpMove}\n onQueuedFollowUpRemove={onQueuedFollowUpRemove}\n onQueuedFollowUpUpdate={onQueuedFollowUpUpdate}\n onQueuedFollowUpSteer={onQueuedFollowUpSteer}\n onQueuedFollowUpCombine={onQueuedFollowUpCombine}\n queueSteeringUnavailableReason={queueSteeringUnavailableReason}\n unsavedQueueItemIds={unsavedQueueItemIds}\n queuedComposer={queuedComposer}\n queuedFollowUps={queuedFollowUps}\n streaming={streaming}\n workspaceHub={workspaceHub}\n />\n </Box>\n </Flex>\n </ChatQuestionNavigationContext>\n </ChatLinkProvider>\n </ChatImageHistoryContext>\n );\n};\n","import { Skeleton, Stack } from \"@chakra-ui/react\";\nimport { ChatMessage } from \"./ai-message\";\n\ninterface SkeletonLinesProps {\n widths: string[];\n}\n\nconst SkeletonLines = (props: SkeletonLinesProps) => {\n const { widths } = props;\n\n return (\n <Stack gap=\"xs\" w=\"full\">\n {widths.map((width, index) => (\n <Skeleton key={`${width}-${index}`} height=\"3\" width={width} borderRadius=\"xs\" />\n ))}\n </Stack>\n );\n};\n\nexport const ChatSkeleton = () => {\n return (\n <Stack minH=\"full\" py=\"xs\" gap=\"0\">\n <ChatMessage.Root from=\"user\">\n <ChatMessage.Content from=\"user\">\n <SkeletonLines widths={[\"72%\", \"46%\"]} />\n </ChatMessage.Content>\n </ChatMessage.Root>\n <ChatMessage.Root from=\"assistant\">\n <ChatMessage.Content from=\"assistant\">\n <SkeletonLines widths={[\"76%\", \"62%\", \"40%\"]} />\n </ChatMessage.Content>\n </ChatMessage.Root>\n </Stack>\n );\n};\n","import { Box, chakra, Flex, Portal, Stack, Text } from \"@chakra-ui/react\";\nimport { type PointerEvent, useState } from \"react\";\n\nexport interface ConversationBrowseItem {\n /** Turn id used to scroll the log to this user message. */\n id: string;\n /** The user message this tick indexes (shown in the hover card). */\n message: string;\n /** Optional assistant reply preview; hidden for a turn not yet answered. */\n reply?: string;\n}\n\ninterface ConversationBrowseProps {\n items: ConversationBrowseItem[];\n onSelect?: (id: string) => void;\n /** Overlay the log's left edge with a scrim instead of reserving a gutter (panels under ~480px). */\n floating?: boolean;\n}\n\n// The rail is a lens, not a chart: tick length encodes distance from the pointer, never content.\nconst MIN_USER_MESSAGES = 3;\nconst TICK_MIN_WIDTH = 10;\nconst TICK_MAX_WIDTH = 26;\nconst LENS_RADIUS = 4;\n\ninterface BrowseCardPosition {\n left: number;\n top: number;\n}\n\n// Raised-cosine falloff over LENS_RADIUS neighbours: 1 at the pointer, 0 at the edge of the lens.\nconst lensFactor = (index: number, pointerIndex: number | null) => {\n if (pointerIndex === null) return 0;\n const distance = Math.abs(index - pointerIndex);\n if (distance >= LENS_RADIUS) return 0;\n return (1 + Math.cos((Math.PI * distance) / LENS_RADIUS)) / 2;\n};\n\nconst tickColor = (index: number, pointerIndex: number | null) => {\n if (pointerIndex === null) return \"fg.subtle\";\n const distance = Math.abs(index - pointerIndex);\n if (distance < 0.5) return \"fg\";\n if (distance < LENS_RADIUS) return \"fg.muted\";\n return \"fg.subtle\";\n};\n\nconst ConversationBrowseCard = (props: { item: ConversationBrowseItem; position: BrowseCardPosition }) => {\n const { item, position } = props;\n\n return (\n <Portal>\n <Box\n position=\"fixed\"\n left={`${position.left}px`}\n ml=\"2xs\"\n top={`${position.top}px`}\n transform=\"translateY(-50%)\"\n w=\"80\"\n maxW=\"80\"\n zIndex=\"popover\"\n pointerEvents=\"none\"\n >\n <Stack gap=\"1.5\" p=\"3\" bg=\"bg.elevated\" borderWidth=\"1px\" borderColor=\"border\" borderRadius=\"lg\">\n <Text textStyle=\"label/S/medium\" color=\"fg\" lineClamp={2}>\n {item.message}\n </Text>\n {item.reply ? (\n <Text textStyle=\"label/XS/regular\" color=\"fg.muted\" lineClamp={2}>\n {item.reply}\n </Text>\n ) : null}\n </Stack>\n </Box>\n </Portal>\n );\n};\n\n/**\n * ChatBrowse — the conversation scrubber for the chat log's left gutter. One tick per user\n * message, in order; the ticks nearest the pointer swell into a lens (growing along X only, so\n * the row you aim at never moves), and the active tick raises a preview card. Clicking a tick\n * selects that turn. Hidden below a few messages, where a gutter costs space and buys nothing.\n */\nexport const ConversationBrowse = (props: ConversationBrowseProps) => {\n const { items, onSelect, floating = false } = props;\n const [pointerIndex, setPointerIndex] = useState<number | null>(null);\n const [cardPosition, setCardPosition] = useState<BrowseCardPosition | null>(null);\n\n if (items.length < MIN_USER_MESSAGES) return null;\n\n const handlePointerMove = (event: PointerEvent<HTMLDivElement>) => {\n const rect = event.currentTarget.getBoundingClientRect();\n const fraction = (event.clientY - rect.top) / rect.height;\n const next = Math.min(items.length - 1, Math.max(0, fraction * items.length - 0.5));\n const nextActiveIndex = Math.round(next);\n setPointerIndex(next);\n setCardPosition({\n left: rect.right,\n top: rect.top + ((nextActiveIndex + 0.5) / items.length) * rect.height,\n });\n };\n\n const activeIndex = pointerIndex === null ? null : Math.round(pointerIndex);\n const activeItem = activeIndex === null ? null : items[activeIndex];\n\n return (\n <Box position=\"relative\" w=\"10\" flexShrink={0}>\n <Flex\n direction=\"column\"\n align=\"flex-start\"\n gap=\"1.5\"\n px=\"1.5\"\n py=\"2\"\n w=\"10\"\n onPointerMove={handlePointerMove}\n onPointerLeave={() => setPointerIndex(null)}\n {...(floating\n ? {\n position: \"absolute\",\n insetInlineStart: 0,\n top: 0,\n bottom: 0,\n // The scrim must be the surface the rail covers — the panel's own bg, never a lighter tone.\n bg: \"bg\",\n }\n : {})}\n >\n {items.map((item, index) => (\n <chakra.button\n type=\"button\"\n key={item.id}\n h=\"2px\"\n w={`${TICK_MIN_WIDTH + (TICK_MAX_WIDTH - TICK_MIN_WIDTH) * lensFactor(index, pointerIndex)}px`}\n bg={tickColor(index, pointerIndex)}\n borderRadius=\"1px\"\n transition=\"width 80ms linear, background-color 80ms linear\"\n aria-label={`Jump to message ${index + 1}`}\n onClick={() => onSelect?.(item.id)}\n />\n ))}\n </Flex>\n {activeItem && cardPosition ? <ConversationBrowseCard item={activeItem} position={cardPosition} /> : null}\n </Box>\n );\n};\n","import {\n Button,\n chakra,\n Field,\n HStack,\n Icon,\n Input,\n Menu,\n Popover,\n Portal,\n Stack,\n Tag,\n Text,\n useSlotRecipe,\n} from \"@chakra-ui/react\";\nimport { useState } from \"react\";\nimport { ListRow } from \"@/components/list-row/list-row\";\nimport { getIconComponent } from \"@/components/primitives/icon-options\";\nimport { Tooltip } from \"@/components/primitives/tooltip\";\n\ninterface HarnessAction {\n id: string;\n label: string;\n icon?: string;\n argument?: { label: string; value?: string };\n}\ninterface HarnessMode {\n id: string;\n label: string;\n description: string;\n state: string;\n indicator?: { label: string; tone: \"neutral\" | \"info\" | \"success\" | \"warning\" | \"error\" };\n tagText?: string;\n closeActionId?: string;\n confirmation?: { id: string; title: string; actionId: string; cancelLabel?: string };\n actions: HarnessAction[];\n}\ninterface LocalTag {\n label: string;\n description: string;\n onClose: () => void;\n closeLabel?: string;\n}\nexport interface HarnessControlsProps {\n modes: HarnessMode[];\n draftTag?: LocalTag;\n sentTag?: LocalTag;\n pending?: boolean;\n unavailable?: boolean;\n onRequestConfirmation?: (modeId: string) => void;\n onAction: (modeId: string, actionId: string, argument?: string, modeSnapshot?: HarnessMode) => Promise<void>;\n}\n\nconst LocalModeTag = (props: { tag: LocalTag }) => {\n const { tag } = props;\n return (\n <Menu.Root>\n <Tooltip content={tag.description} openDelay={300} closeDelay={150}>\n <Tag.Root variant=\"ticket\" size=\"composer\">\n <Menu.Trigger asChild>\n <Tag.Label asChild>\n <button type=\"button\" aria-label={tag.description}>\n {tag.label}\n </button>\n </Tag.Label>\n </Menu.Trigger>\n <Tag.CloseTrigger aria-label={tag.closeLabel ?? `Remove ${tag.label}`} onClick={tag.onClose} />\n </Tag.Root>\n </Tooltip>\n <Portal>\n <Menu.Positioner>\n <Menu.Content>\n <Text p=\"sm\" textStyle=\"label/S/regular\" overflowWrap=\"anywhere\">\n {tag.description}\n </Text>\n </Menu.Content>\n </Menu.Positioner>\n </Portal>\n </Menu.Root>\n );\n};\n\nconst NativeModeTag = (props: {\n mode: HarnessMode;\n pending?: boolean;\n unavailable?: boolean;\n onRequestConfirmation?: HarnessControlsProps[\"onRequestConfirmation\"];\n onAction: HarnessControlsProps[\"onAction\"];\n}) => {\n const { mode, pending, unavailable, onRequestConfirmation, onAction } = props;\n const styles = useSlotRecipe({ key: \"menu\" })();\n const [editing, setEditing] = useState<{ action: HarnessAction; mode: HarnessMode } | null>(null);\n const [argument, setArgument] = useState(\"\");\n const [open, setOpen] = useState(false);\n const closeAction = mode.actions.find((action) => action.id === mode.closeActionId && !action.argument);\n const invoke = async (action: HarnessAction, value?: string, modeSnapshot = mode) => {\n try {\n await onAction(mode.id, action.id, value, modeSnapshot);\n setEditing(null);\n setOpen(false);\n return true;\n } catch {\n /* The conversation owns operation errors. Keep the native tag until readback. */\n return false;\n }\n };\n let status = mode.state;\n if (pending) status = `Checking · Last confirmed: ${mode.state}`;\n if (unavailable) status = `Status unavailable · Last confirmed: ${mode.state}`;\n return (\n <Popover.Root\n open={open}\n positioning={{ placement: \"top-start\" }}\n onOpenChange={(details) => {\n setOpen(details.open);\n if (!details.open) setEditing(null);\n }}\n >\n <Tooltip content={`${mode.label}: ${mode.description} · ${status}`} openDelay={300} closeDelay={150}>\n <Tag.Root variant=\"ticket\" size=\"composer\">\n {mode.indicator ? (\n <Tag.StartElement>\n <chakra.span\n role=\"img\"\n aria-label={unavailable ? \"Status unavailable\" : mode.indicator.label}\n data-status-dot=\"\"\n data-tone={unavailable ? \"neutral\" : mode.indicator.tone}\n />\n </Tag.StartElement>\n ) : null}\n <Popover.Trigger asChild>\n <Tag.Label asChild>\n <button type=\"button\" aria-label={`${mode.label} details`}>\n {mode.label}\n </button>\n </Tag.Label>\n </Popover.Trigger>\n {closeAction ? (\n <Tag.CloseTrigger\n aria-label={closeAction.label}\n disabled={pending || unavailable}\n onClick={() => void invoke(closeAction)}\n />\n ) : null}\n </Tag.Root>\n </Tooltip>\n <Portal>\n <Popover.Positioner>\n <Popover.Content css={styles.content} aria-label={`${mode.label} details`}>\n <Stack p=\"sm\" gap=\"xs\">\n <Text textStyle=\"label/S/medium\">{mode.label}</Text>\n <Text textStyle=\"label/S/regular\" overflowWrap=\"anywhere\">\n {mode.description}\n </Text>\n <Text textStyle=\"label/XS/regular\" color=\"fg.muted\">\n {status}\n </Text>\n {editing?.action.argument ? (\n <Field.Root>\n <Field.Label>{editing.action.argument.label}</Field.Label>\n <Input autoFocus size=\"sm\" value={argument} onChange={(event) => setArgument(event.target.value)} />\n <HStack>\n <Button size=\"xs\" variant=\"ghost\" onClick={() => setEditing(null)}>\n Cancel\n </Button>\n <Button\n size=\"xs\"\n variant=\"ghost\"\n disabled={pending || unavailable || !argument.trim()}\n onClick={() => void invoke(editing.action, argument, editing.mode)}\n >\n Apply\n </Button>\n </HStack>\n </Field.Root>\n ) : null}\n </Stack>\n {!editing\n ? mode.actions.map((action) => (\n <ListRow\n key={action.id}\n role=\"button\"\n variant=\"full-width\"\n label={action.label}\n icon={action.icon ? <Icon as={getIconComponent(action.icon)} boxSize=\"icon-xs\" /> : undefined}\n disabled={\n pending || unavailable || (action.id === mode.confirmation?.actionId && !onRequestConfirmation)\n }\n onActivate={() => {\n if (action.id === mode.confirmation?.actionId) {\n setOpen(false);\n onRequestConfirmation?.(mode.id);\n } else if (action.argument) {\n setArgument(action.argument.value ?? \"\");\n setEditing({ action, mode });\n } else void invoke(action);\n }}\n />\n ))\n : null}\n </Popover.Content>\n </Popover.Positioner>\n </Portal>\n </Popover.Root>\n );\n};\n\nexport const HarnessControls = (props: HarnessControlsProps) => {\n const { modes, draftTag, sentTag, pending, unavailable, onRequestConfirmation, onAction } = props;\n return (\n <HStack gap=\"2xs\" minW=\"0\" aria-label=\"Harness controls\">\n {modes.map((mode) => (\n <NativeModeTag\n key={mode.id}\n mode={mode}\n pending={pending}\n unavailable={unavailable}\n onRequestConfirmation={onRequestConfirmation}\n onAction={onAction}\n />\n ))}\n {draftTag ? <LocalModeTag tag={draftTag} /> : null}\n {sentTag ? <LocalModeTag tag={sentTag} /> : null}\n </HStack>\n );\n};\n","import { Flex, HStack, Spinner, Text } from \"@chakra-ui/react\";\nimport { AlertTriangle } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\ntype WorkspaceHubStatus = \"ready\" | \"loading\" | \"error\";\n\ninterface ChatWorkspaceHubProps {\n /** Workspace identity/selector shown at the start of the header (e.g. GitBranch + name). */\n workspaceControl?: ReactNode;\n additions: number;\n deletions: number;\n /** Icon-only action that opens the workspace resource. */\n action?: ReactNode;\n status?: WorkspaceHubStatus;\n statusLabel?: string;\n}\n\nconst HubStatus = (props: {\n status: WorkspaceHubStatus;\n statusLabel?: string;\n additions: number;\n deletions: number;\n}) => {\n const { status, statusLabel, additions, deletions } = props;\n\n if (status === \"loading\") {\n return (\n <HStack gap=\"2xs\" minW=\"0\">\n <Spinner size=\"xs\" color=\"fg.muted\" />\n <Text textStyle=\"label/XS/regular\" color=\"fg.muted\" truncate>\n {statusLabel ?? \"Setting up workspace...\"}\n </Text>\n </HStack>\n );\n }\n\n if (status === \"error\") {\n return (\n <HStack gap=\"2xs\" minW=\"0\">\n <AlertTriangle size={14} color=\"var(--chakra-colors-fg-error)\" />\n <Text textStyle=\"label/XS/regular\" color=\"fg.error\" truncate>\n {statusLabel ?? \"Workspace setup failed\"}\n </Text>\n </HStack>\n );\n }\n\n // Ready: the diff counts take the slot, and only when there is something to show.\n if (additions <= 0 && deletions <= 0) return null;\n\n return (\n <HStack gap=\"2xs\">\n <Text textStyle=\"label/XS/medium\" color=\"fg.success\">\n +{additions}\n </Text>\n <Text textStyle=\"label/XS/medium\" color=\"fg.error\">\n −{deletions}\n </Text>\n </HStack>\n );\n};\n\n/**\n * Workspace hub header: the frame the session sits in. The identity is always present;\n * the slot beside it carries the diff counts, or the setup status while the workspace is\n * being created or has failed. The open action recedes during setup.\n */\nexport const ChatWorkspaceHub = (props: ChatWorkspaceHubProps) => {\n const { workspaceControl, additions, deletions, action, status = \"ready\", statusLabel } = props;\n\n return (\n <Flex align=\"center\" justify=\"space-between\" gap=\"sm\" minW=\"0\" pl=\"xs\" pr=\"2xs\" py=\"2xs\">\n <HStack gap=\"sm\" minW=\"0\">\n {workspaceControl}\n <HubStatus status={status} statusLabel={statusLabel} additions={additions} deletions={deletions} />\n </HStack>\n {action ? <Flex flexShrink={0}>{action}</Flex> : null}\n </Flex>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAIA,IAAaE,WAA4B;CAAA,IAAAC,IAAAC,EAAA,CAAA,GACvC,EAAAC,cAAAC,eAAAC,sBAAkDN,GAAwB,GAAEO,GAAAC;CAC5ET,AAD4EG,EAAA,OAAAE,KAAAF,EAAA,OAAAI,KAAAJ,EAAA,OAAAG,KAC5DE,UAAA;EACd,IAAAE,IAAiBL,EAASM;EAC1B,IAAI,CAACD,GAAQ;EACb,IAAAE,IAAa,IACbC,IAAe;GAAAC,KAAOJ,EAAQK;GAAUC,QAAU;EAAK,GACvDC,IAAY,GACZC,UAAyB;GACvB,AAAIN,KAAUF,EAAQS,eAAgB,CAAC,CAAAC,WAAY,MACnDP,IAAWA;IAAAA,KACJH,EAAQK;IAAUC,QACfN,EAAQ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,CACG1G,GACDa,CAFK;KAGEL,EAAA,KAAAK,GAAAL,EAAA,KAAAR,GAAAQ,EAAA,KAAAM,KAAAA,IAAAN,EAAA;CAAA,IAAAS;CAAA,AAAAT,EAAA,OAAAL,IAC4Cc,IAAAT,EAAA,MAApDS,IAAAd,IAAS,kBAAC0G,GAAD;EAAkB,YAAA;EAAI1G,UAAAA;CAAjB,CAAA,IAAd,MAAoDK,EAAA,KAAAL,GAAAK,EAAA,KAAAS;CAAA,IAAAC;CAChD,OADgDV,EAAA,QAAAM,KAAAN,EAAA,QAAAS,KALvDC,IAAA,kBAAC2F,GAAD;EAAY,OAAA;EAAiB,SAAA;EAAoB,KAAA;EAAU,MAAA;EAAO,IAAA;EAAQ,IAAA;EAAS,IAAA;EAAnF,UAAA,CACE/F,GAICG,CALE;KAMET,EAAA,MAAAM,GAAAN,EAAA,MAAAS,GAAAT,EAAA,MAAAU,KAAAA,IAAAV,EAAA,KANPU;AAMO"}
|
|
1
|
+
{"version":3,"file":"chat-ui.js","names":["useLayoutEffect","useStickToBottomContext","useConversationVisibility","$","_c","scrollRef","stopScroll","scrollToBottom","t0","t1","viewport","current","hidden","position","top","scrollTop","atTail","frame","rememberPosition","getClientRects","length","scrollHeight","clientHeight","observer","ResizeObserver","isHidden","saved","requestAnimationFrame","addEventListener","observe","cancelAnimationFrame","disconnect","removeEventListener","_c","HTMLChakraProps","IconButtonProps","AbsoluteCenter","chakra","IconButton","ArrowDownIcon","StickToBottom","StickToBottomEl","useStickToBottomContext","ScrollArea","useConversationVisibility","ConversationRootProps","React","ComponentProps","conversationRootDefaultProps","initial","resize","role","const","ConversationRoot","base","position","flex","overflow","height","forwardProps","defaultProps","ConversationContentProps","Omit","ConversationContent","props","$","_c","children","rest","contentRef","scrollRef","t0","Ref","HTMLDivElement","t1","t2","t3","Symbol","for","zIndex","layerStyle","py","t4","ConversationScrollButtonProps","conversationScrollButtonContainerDefaultProps","axis","bottom","ConversationScrollButton","isAtBottom","scrollToBottom","ChatPrimitives","Root","Viewport","ScrollToBottom","StickToBottomEl","_c","ScrollArea","HTMLChakraProps","RecipeVariantProps","createSlotRecipeContext","defineSlotRecipe","recipe","className","slots","base","root","display","width","alignItems","justifyContent","gap","mb","content","flexDirection","textStyle","overflow","borderRadius","variants","from","user","bg","px","py","assistant","developer","size","sm","md","lg","delivery","sent","unsent","opacity","shape","rounded","pill","square","defaultVariants","withProvider","withContext","VariantProps","MessageRootProps","MessageRoot","HTMLDivElement","MessageContentProps","MessageContent","ChatMessage","Root","Content","const","Box","Button","Code","Flex","HStack","Text","ShieldCheck","ShieldX","ScrollArea","ApprovalPromptProps","toolName","toolInput","onApprove","onDeny","formatToolInput","input","text","JSON","stringify","length","truncated","slice","ApprovalPrompt","props","$","_c","t0","formattedInput","t1","t2","t3","Symbol","for","t4","t5","t6","t7","t8","_c","ScrollArea","Stack","ReactNode","Fragment","ResourceBadgeProps","ResourceBadge","AttachmentListRenderBadge","props","AttachmentListItemRenderProps","attachmentId","onSelect","onRemove","size","tone","AttachmentListProps","attachments","renderBadge","DEFAULT_SIZE","NonNullable","DEFAULT_TONE","AttachmentList","$","_c","t0","t1","t2","t3","undefined","length","t4","t5","attachment","select","remove","rendered","map","_c","Fragment","useEffect","useRef","useStickToBottomContext","AutoScrollProps","userMessageCount","conversationKey","ShouldAutoScrollArgs","previousUserMessageCount","AutoScrollState","NextAutoScrollStateArgs","state","ScrollForNextAutoScrollStateArgs","scrollToBottom","animation","shouldAutoScroll","args","getNextAutoScrollState","shouldScroll","Math","max","scrollForNextAutoScrollState","next","AutoScroll","props","$","_c","t0","t1","stateRef","t2","t3","current","_c","defineSlotRecipe","chatComposerRecipe","className","slots","base","input","position","width","padding","bg","borderRadius","_focusWithin","outline","outlineOffset","workspace","display","flexDirection","gap","variants","attachedToTop","true","borderTopRadius","generateEditorStateFromString","createSerializedPromptState","input","JSON","stringify","ChatInputActionState","canInterrupt","canSubmit","hasQuestionPrompt","isDisabled","streaming","text","ChatInputAction","hasMessageText","trim","length","resolveChatInputKeyboardAction","state","resolveChatInputButtonAction","ClipboardEvent","DragEvent","DEFAULT_TEXT_ATTACHMENT_PASTE_LINE_THRESHOLD","shouldAttachPastedText","text","lineThreshold","length","split","createAttachmentEventHandlers","input","onAttachFiles","files","File","onAttachText","textAttachmentPasteLineThreshold","onPasteCapture","event","HTMLDivElement","Array","from","clipboardData","preventDefault","pastedText","getData","onDropCapture","dataTransfer","onDragOver","types","includes","IconButton","IconButtonProps","Kbd","Portal","Tooltip","ArrowUp","Pause","SendButtonProps","shortcut","title","canInterrupt","SendButton","props","$","_c","rest","ariaLabel","t0","icon","t1","button","t2","tooltipContent","t3","t4","t5","_c","_Fragment","Button","HStack","ReactNode","ScrollArea","ChatInputAction","COMPOSER_CONTROL_HEIGHT","SendButton","ChatInputToolbarProps","actions","submitActions","questionPrompt","skipDisabled","skipTitle","onSkip","buttonAction","submitTitle","submitLabel","messageTitle","runAction","action","ChatInputToolbar","props","$","_c","t0","t1","t2","undefined","t3","_c","ScrollArea","ReactNode","ChatInputQuestionResponse","ComposerDecision","id","controls","model","pending","actions","label","variant","disabled","onAction","actionId","Promise","ComposerResponseInput","response","text","attachments","onSubmit","onClearAttachments","submitComposerResponse","input","OTHER_CHOICE_LABEL","OTHER_CHOICE_VALUE","getOwnQuestionValue","values","Record","T","key","Object","hasOwn","undefined","questionOffersOtherChoice","question","options","allowCustomAnswer","Boolean","length","getOwnQuestionValue","ChatInputQuestionOption","label","description","ChatInputQuestion","id","question","options","multiple","required","allowCustomAnswer","ChatInputQuestionPrompt","questions","callId","delivery","ChatInputQuestionResponse","answers","ChatInputQuestionCustomAnswers","Record","getQuestionSelectionKey","index","isQuestionOtherSelected","customAnswersByQuestion","questionIndex","Object","hasOwn","clearQuestionOtherAnswer","_removed","rest","toggleQuestionOtherAnswer","SKIPPED_QUESTION_TEXT","toQuestionResponse","questionPrompt","buildSkippedQuestionResponse","toggleQuestionOptionSelection","selectedOptionsByQuestion","optionLabel","key","selected","alreadySelected","includes","filter","getQuestionPromptSignature","JSON","stringify","map","Boolean","option","answersForQuestion","selectedLabels","customAnswer","typed","trim","getAnswersForQuestion","getQuestionAnswerLines","lines","length","push","join","isCustomAnswersByQuestion","value","toCustomAnswersByQuestion","answerInput","trimmed","fromEntries","flatMap","buildQuestionResponse","legacyText","hasCustomQuestions","some","buildQuestionAnswerValues","hasMissingRequiredQuestionAnswer","Button","Check","Tooltip","ChatInputQuestion","ChatInputQuestionCustomAnswers","getAnswersForQuestion","getQuestionSelectionKey","QuestionStepTabProps","question","questionIndex","isActive","selectedOptionsByQuestion","Record","customAnswersByQuestion","onSelectStep","hasQuestionAnswer","key","length","QuestionStepTab","props","$","_c","t0","isAnswered","stepStateLabel","tabVariant","t1","id","t2","t3","t4","t5","t6","t7","_c","Tooltip","SessionMessage","ToolPart","QuestionFormBlockOption","QuestionFormBlockQuestion","isRecord","value","Record","Array","isArray","parseJsonObjectText","parsed","JSON","parse","toInputRecord","input","trim","length","getStringValue","getQuestionResponseText","stringValue","lines","map","filter","line","join","response","answer","text","answers","carriesAnswers","hasQuestionResponse","parseQuestionOption","label","description","undefined","parseQuestion","index","question","options","option","type","declaredCustomAnswer","allowCustomAnswer","custom","id","multiple","required","parseQuestionPrompt","record","questions","delivery","const","isQuestionTool","part","tool","toLowerCase","orderedQuestionRequests","messages","requests","Map","message","role","parts","set","callId","values","getQuestionRequestKey","stringify","state","isPendingQuestion","status","output","metadata","questionPromptFor","prompt","resolveQuestionPrompt","key","find","resolveActiveQuestionPrompt","getQuestionBubbleAnswer","split","section","startsWith","slice","getStringValue","isQuestionTool","createContext","useContext","useState","getQuestionRequestKey","resolveQuestionPrompt","SessionMessage","ToolPart","QuestionSelection","conversationKey","key","index","revision","QuestionNavigation","activeKey","selection","open","part","selectStep","close","ChatQuestionNavigationContext","undefined","useQuestionNavigation","useChatQuestionNavigation","messages","$","_c","setSelection","current","t0","prompt","t1","t2","t3","previous","t4","t5","Symbol","for","index_0","previous_0","t6","t7","t8","value","_c","Box","Stack","Text","Textarea","FormEvent","ReactNode","Checkbox","Radio","RadioGroup","getOwnQuestionValue","OTHER_CHOICE_LABEL","OTHER_CHOICE_VALUE","questionOffersOtherChoice","QuestionFormBlockQuestion","TodoListBlockItem","preventSubmit","event","preventDefault","QuestionFormBlockViewProps","questions","editable","selectedOptionsByQuestion","Record","customAnswersByQuestion","onToggleOption","question","questionIndex","optionLabel","onToggleOther","onCustomAnswerChange","answer","QuestionOptionContent","props","$","_c","option","t0","label","t1","description","t2","QuestionCheckboxOptionRow","name","checked","onToggle","undefined","tabIndex","t3","t4","t5","QuestionRadioOptions","selectedOption","otherSelected","otherField","hasOtherChoice","options","findIndex","selectedIndex","selectedValue","String","details","value","Number","t6","t7","option_0","optionIndex","map","t8","t9","TodoListBlockView","items","_temp","QuestionFieldsetProps","selectedOptions","customAnswer","QuestionOtherField","editablePlaceholder","currentTarget","QuestionCheckboxOptions","includes","QuestionFieldset","id","allowCustomAnswer","hasChoices","length","multiple","QuestionFormBlockView","item","index","_c","Checkbox","RadioGroup","_temp","_Fragment","HStack","Stack","useEffect","useRef","useState","ChatInputQuestion","ChatInputQuestionCustomAnswers","ChatInputQuestionPrompt","getQuestionPromptSignature","getQuestionSelectionKey","isQuestionOtherSelected","QuestionStepTab","useQuestionNavigation","getOwnQuestionValue","QuestionFormBlockView","QuestionPromptControlsProps","isEditable","questionPrompt","selectedOptionsByQuestion","Record","customAnswersByQuestion","onToggleOption","question","questionIndex","optionLabel","onToggleOther","onCustomAnswerChange","answer","QuestionPromptStepperProps","questions","ReturnType","toQuestionFormQuestions","map","index","id","options","multiple","Boolean","required","allowCustomAnswer","QuestionPromptStepper","props","$","_c","activeQuestionIndex","setActiveQuestionIndex","questionPanelRef","navigation","selection","focusRevision","revision","t0","t1","undefined","current","focus","t2","selectStep","renderQuestionIndex","Math","min","length","activeQuestion","hasMultipleQuestions","t3","t4","t5","t6","t7","t8","t9","_question","_questionIndex","question_0","selectedOptions","hadSelection","t10","t11","_question_0","_questionIndex_0","t12","t13","t14","QuestionPromptControls","questionPromptSignature","_c","useEffect","useRef","useState","buildQuestionAnswerValues","buildQuestionResponse","ChatInputQuestion","ChatInputQuestionCustomAnswers","ChatInputQuestionPrompt","clearQuestionOtherAnswer","getQuestionPromptSignature","getQuestionSelectionKey","hasMissingRequiredQuestionAnswer","toggleQuestionOptionSelection","toggleQuestionOtherAnswer","defaultSelections","prompt","Object","fromEntries","questions","flatMap","question","index","delivery","options","length","label","useQuestionPromptState","questionPrompt","resetToken","selectedOptionsByQuestion","setSelectedOptionsByQuestion","Record","customAnswersByQuestion","setCustomAnswersByQuestion","signature","previousResetRef","JSON","stringify","reset","current","toggleOption","questionIndex","optionLabel","multiple","toggleOther","setCustomAnswer","answer","key","restore","selected","custom","responseText","hasMissingRequiredAnswer","buildAnswers","Button","ReactNode","useRef","useState","ChatInputAction","buildSkippedQuestionResponse","ChatInputQuestionPrompt","ChatInputQuestionResponse","QuestionPromptControls","SKIPPED_QUESTION_TEXT","toQuestionResponse","ChatInputToolbar","useQuestionNavigation","useQuestionPromptState","ChatInputQuestionFormProps","prompt","actions","disabled","onSubmit","text","response","Promise","ChatInputQuestionForm","props","$","_c","question","navigation","submitting","setSubmitting","inFlight","t0","t1","skip","undefined","current","hasMissingRequiredAnswer","sent","selectedOptions","selectedOptionsByQuestion","customAnswers","customAnswersByQuestion","responseText","buildAnswers","reset","restore","submit","t2","setCustomAnswer","toggleOption","toggleOther","t3","delivery","close","t4","t5","t6","t7","t8","action","t9","t10","_c","_Fragment","Button","Flex","HStack","Text","useRef","useState","COMPOSER_CONTROL_HEIGHT","ComposerDecision","ComposerDecisionToolbarProps","decision","disabled","ComposerDecisionToolbar","props","submitting","setSubmitting","inFlight","choose","actionId","action","actions","find","item","id","current","pending","onAction","controls","model","map","variant","label","ReactNode","ChatInputQuestionForm","ChatInputQuestionPrompt","ChatInputQuestionResponse","getQuestionPromptSignature","ComposerDecision","ComposerDecisionToolbar","ComposerRequest","ComposerTakeoverProps","request","question","decision","actions","disabled","submitDisabled","onSubmit","answer","response","Promise","ComposerTakeover","props","$","_c","kind","t0","id","t1","t2","_c","useState","useComposerFocus","autoFocus","focusSignal","$","_c","requested","setRequested","t0","source","setSource","t1","t2","Symbol","for","t3","request","complete","_c","SessionMessage","MAX_RECENT_USER_PROMPTS","getRecentUserPrompts","messages","prompts","i","length","message","role","text","parts","flatMap","part","type","join","trim","push","movePromptHistory","index","direction","count","Math","min","useEffect","useRef","PromptEditorRef","MAX_RECENT_USER_PROMPTS","movePromptHistory","ChatInputHistoryOptions","recentUserMessages","text","blocked","resetKey","onChange","useChatInputHistory","options","$","_c","editorRef","historyIndex","prompts","t0","slice","signature","JSON","stringify","resetSignature","previousResetSignature","t1","t2","current","t3","Symbol","for","reset","t4","value","change","t5","direction","movement","length","index","value_0","setEditorValue","recall","t6","t7","t8","recallPrevious","recallNext","_c","useState","getTextFromSerializedEditorState","useChatInputText","defaultState","$","_c","adoptedState","setAdoptedState","editorState","setEditorState","editorKey","setEditorKey","t0","text","setText","t1","Symbol","for","state","_temp","remountEditor","nextText","t2","key","_c","_temp","ChatInputQuestionPrompt","getQuestionPromptSignature","ComposerDecision","ComposerRequest","kind","id","resolveComposerRequest","question","decision","Pick","active","waiting","push","callId","find","request","useState","ChatInputQuestionPrompt","ComposerDecision","ComposerRequest","resolveComposerRequest","useComposerRequest","question","decision","active","setActive","request","kind","id","Box","Flex","Text","useSlotRecipe","MouseEvent","ReactNode","useState","ScrollArea","chatComposerRecipe","PromptCommand","PromptEditor","PromptSelectionSnapshot","createSerializedPromptState","ChatInputAction","resolveChatInputButtonAction","resolveChatInputKeyboardAction","createAttachmentEventHandlers","DEFAULT_TEXT_ATTACHMENT_PASTE_LINE_THRESHOLD","ChatInputQuestionPrompt","ChatInputQuestionResponse","ChatInputToolbar","COMPOSER_CONTROL_HEIGHT","ComposerDecision","submitComposerResponse","ComposerTakeover","useComposerFocus","useChatInputHistory","useChatInputText","useComposerRequest","ChatInputProps","defaultState","recentUserMessages","placeholder","onSubmit","text","attachments","questionResponse","Promise","onInterrupt","onAttachFiles","files","File","onAttachText","textAttachmentPasteLineThreshold","streaming","attachedResources","onClearAttachments","isDisabled","submitDisabled","onChange","attachmentList","actions","submitActions","attachmentActions","attachedToTop","questionPrompt","decision","autoFocus","focusSignal","submitTitle","submitLabel","initialSelection","onSelectionChange","selection","onEditorStateChange","state","retainTextUntilAcknowledged","commands","ChatInputPlaceholder","props","$","_c","t0","ChatInput","request","occupied","Boolean","styles","recipe","submitting","setSubmitting","editorKey","editorState","remountEditor","setEditorState","setText","focus","history","blocked","resetKey","String","value","handleContainerClick","event","HTMLDivElement","target","Element","currentTarget","contains","closest","replaceDraftText","change","canSubmit","actionState","canInterrupt","hasQuestionPrompt","buttonAction","messageTitle","submitMessage","trim","sentText","reset","runAction","action","attachmentEventHandlers","input","undefined","onPasteCapture","onDropCapture","onDragOver","answer","response","pr","editorRef","recallPrevious","recallNext","requested","complete","nextText","JSON","stringify","_c","ScrollArea","_Fragment","useRef","MessageAnimationState","initialized","seenKeys","Set","NextMessageAnimationStateArgs","itemKeys","state","messageFadeInProps","animationName","animationDuration","animationTimingFunction","const","getNextMessageAnimationState","args","animatedKeys","key","has","add","itemKeysEqual","a","b","length","index","useMessageAnimationKeys","stateRef","lastResultRef","current","next","Box","HStack","IconButton","Text","Check","Copy","useEffect","useRef","useState","Tooltip","ChatMessagePart","SessionMessage","MessageActionPanelProps","message","alwaysVisible","copyAlwaysVisible","isCopyablePart","part","Extract","type","getMessageCopyText","parts","filter","map","text","trim","Boolean","join","getMessageTimestampLabel","locale","timeZone","delivery","createdAt","Intl","DateTimeFormat","hour","minute","format","Date","MessageActionPanel","props","$","_c","t0","t1","undefined","isCopied","setIsCopied","copyResetTimeoutRef","t2","copyText","t3","timestampLabel","t4","t5","Symbol","for","current","window","clearTimeout","t6","navigator","clipboard","writeText","setTimeout","copyMessage","t7","t8","t9","t10","messageActionPanelHoverStyles","t11","opacity","pointerEvents","_c","Tooltip","BoxProps","Box","RichMessage","ChatLinkProps","ChatRichContentProps","Omit","children","streaming","ChatRichContent","props","$","_c","linkHandler","rest","t0","t1","Response","_c","chakra","Stack","useRecipe","ArrowRight","chatQuestionBubbleRecipe","getQuestionBubbleAnswer","getQuestionRequestKey","isPendingQuestion","parseQuestionPrompt","useQuestionNavigation","ToolPart","ChatQuestionBubbleProps","part","ChatQuestionBubble","props","$","_c","prompt","state","input","navigation","t0","Symbol","for","recipe","t1","pending","canOpen","Boolean","T0","t2","t3","t4","question","index","answer","options","label","expanded","activeKey","selection","id","multiline","includes","undefined","open","t5","questions","map","t6","_c","normalizeToolName","value","replace","toLowerCase","getToolNameLookupKeys","normalized","compact","Set","LucideIcon","AlertTriangle","CircleQuestionMark","DotIcon","File","FileDiff","FileDown","FilePen","FileText","FileUp","Globe","ListTodo","ListTree","Move","Search","Terminal","Trash2","normalizeToolName","toolIconMap","shell","ls","read_file","write_file","delete_file","patch","upload_files","download_file","move_file","const","Record","iconMap","dot","danger","search","browser","file","question","todo","terminal","IconName","ToolIconName","DEFAULT_TOOL_ICON","isToolIconName","value","Object","hasOwn","getIconComponent","name","toolTypeToIconName","type","normalized","compact","replace","getFileTypeIcon","TitleSegment","FileChange","filePath","additions","deletions","basenameSafe","path","idx","lastIndexOf","slice","normalizeHeaderPath","input","token","split","trim","normalized","startsWith","replace","isMinusHeader","line","isPlusHeader","isHunkHeader","isAddedLine","isDeletedLine","ensureFileChange","changes","Map","has","set","incrementAdditions","current","get","incrementDeletions","UnifiedDiffState","currentPath","lastMinusHeader","inHunk","processUnifiedDiffLine","state","plusPath","parseUnifiedDiff","diffText","lines","Array","from","entries","map","buildDiffTitleSegments","file","kind","fileName","extractDiffFilePaths","FileDiffPreview","original","modified","isDiffFileBoundary","isInvalidHunkBodyLine","appendHunkLine","text","push","parseHunkBody","startIndex","index","length","parsePreview","oldHeader","next","nextIndex","const","newHeader","preview","join","buildFileDiffPreviews","previews","i","Math","max","ToolPart","Block","TitleSegment","basenameSafe","buildDiffTitleSegments","buildFileDiffPreviews","extractDiffFilePaths","toolTypeToIconName","TOOL_LABELS","Record","apply_patch","bash","edit","glob","grep","read","skill","todowrite","STATE_LABELS","error","input_streaming","running","completed","failed","ApplyPatchMetadataFile","filePath","additions","deletions","diff","before","after","normalizeToolType","value","replace","toLowerCase","toTitleCase","split","filter","token","length","map","toUpperCase","slice","join","getToolType","invocation","tool","getToolLabel","normalized","getStateLabel","state","status","includes","isErrorState","buildIndicator","type","icon","const","buildBaseTitle","detail","labelOverride","detailStyle","label","title","kind","text","bold","push","muted","truncate","monospace","stateLabel","getInputObject","input","Array","isArray","getOutputObject","output","getStringValue","trim","getObjectValue","getStateObject","key","normalizeFilePath","isUnifiedDiff","getApplyPatchMetadataObjects","metadata","Boolean","parseApplyPatchMetadataFile","entry","record","rawPath","relativePath","path","undefined","getApplyPatchMetadataFiles","files","entries","parsedFile","getApplyPatchInputFilePaths","changes","filePaths","change","from","Set","getApplyPatchDiffText","inputDiff","metadataDiff","fileDiffs","file","patchText","buildApplyPatchMetadataTitleSegments","seen","segments","has","add","fileName","getApplyPatchMetadataReferences","getOutputText","outputObject","returnDisplay","preview","stdout","content","parseSkillContentBlock","match","skillName","getSkillName","name","skill_name","buildFileLinkSegment","variant","prependErrorBlock","blocks","errorText","errorBlock","getDiffBlocks","diffText","language","original","modified","sideBySide","getDiffTitleSegments","getDiffReferences","STATE_LABELS","toTitleCase","getToolLabel","getStateLabel","isErrorState","buildIndicator","getStringValue","getObjectValue","Block","Item","buildApplyPatchMetadataTitleSegments","buildBaseTitle","buildFileLinkSegment","buildIndicator","getApplyPatchDiffText","getApplyPatchInputFilePaths","getApplyPatchMetadataFiles","getApplyPatchMetadataReferences","getDiffBlocks","getDiffReferences","getDiffTitleSegments","prependErrorBlock","ToolRenderer","renderApplyPatch","invocation","diffText","metadataFiles","inputFilePaths","title","undefined","diffSegments","length","push","map","filePath","blocks","file","before","after","type","language","original","modified","sideBySide","references","indicator","buildIndicator","Block","Item","buildBaseTitle","buildFileLinkSegment","buildIndicator","getDiffBlocks","getInputObject","getOutputObject","getStringValue","prependErrorBlock","ToolRenderer","buildEditDiff","original","modified","type","language","sideBySide","renderEdit","invocation","input","output","filePath","file_path","undefined","oldString","old_string","newString","new_string","title","push","diffBlocks","diff","indicator","blocks","getStringValue","buildIndicator","ToolPart","Block","Item","TitleSegment","hasQuestionResponse","parseQuestionPrompt","ToolRenderer","QuestionRendererDependencies","buildBaseTitle","invocation","detail","labelOverride","buildIndicator","prependErrorBlock","blocks","createQuestionRenderer","deps","responded","state","output","metadata","prompt","input","block","type","questions","fieldLabel","length","undefined","indicator","title","expandable","Block","Item","buildBaseTitle","buildFileLinkSegment","buildIndicator","getInputObject","getOutputObject","getOutputText","getSkillName","getStringValue","parseSkillContentBlock","prependErrorBlock","ToolRenderer","renderRead","invocation","input","output","filePath","file_path","file","path","undefined","title","push","indicator","blocks","renderCommand","Parameters","label","command","outputText","type","language","code","stderr","exitCode","text","renderBash","renderShell","renderGrep","query","pattern","renderGlob","references","split","map","line","trim","filter","length","renderSkill","parsedOutput","skillName","renderedContent","content","getStringValue","buildIndicator","ToolPart","Block","Item","TitleSegment","ToolRenderer","TodoItem","label","checked","TodowriteRendererDependencies","buildBaseTitle","invocation","detail","labelOverride","buildIndicator","prependErrorBlock","blocks","getStringValue","value","trim","length","getObjectValue","Array","isArray","Record","parseTodoItem","todo","content","title","status","parseTodoItems","items","explicit","listSource","objectValue","todos","map","filter","createTodowriteRenderer","deps","inputTodos","state","input","outputTodos","output","todoState","countLabel","indicator","type","text","renderApplyPatch","renderEdit","createQuestionRenderer","buildBaseTitle","buildIndicator","prependErrorBlock","renderBash","renderGlob","renderGrep","renderRead","renderShell","renderSkill","createTodowriteRenderer","ToolRenderersMap","renderQuestion","renderTodowrite","createDefaultToolRenderers","apply_patch","bash","edit","glob","grep","question","read","shell","skill","todo_write","todowrite","ToolPart","Block","Item","TitleSegment","toolTypeToIconName","getToolNameLookupKeys","normalizeToolName","createDefaultToolRenderers","ToolRenderersMap","ToolTimelineBuilderOptions","STATE_LABELS","Record","error","toTitleCase","value","split","filter","token","length","map","toUpperCase","slice","join","getToolLabel","tool","normalized","replace","isErrorState","state","buildIndicator","invocation","status","type","icon","const","getStateLabel","includes","stringifyValue","undefined","JSON","stringify","isBlankValue","trim","Array","isArray","every","Object","values","getRecord","getString","getMediaType","record","mime_type","mediaType","mimeType","isImageMediaType","Boolean","startsWith","imageUrlPattern","getImageBlock","alt","data","src","url","test","getFileLikeOutput","filePath","path","filename","content","body","text","extensionLanguageBySuffix","css","html","js","json","jsx","md","py","ts","tsx","yaml","yml","getLanguageFromPath","extension","pop","toLowerCase","createLabeledBlocks","label","blocks","buildBlocksForArrayValue","entry","entryRecord","entryType","image","push","buildBlocksForValue","buildBlocksForFileLikeValue","fileLikeOutput","language","code","buildBlocksForAttachmentValue","attachmentName","attachment_name","attachmentId","attachment_file_id","attachmentFileId","imageBlock","fileBlocks","attachmentBlocks","buildGenericBlocks","toolLabel","errorText","input","output","createGenericItem","title","kind","bold","stateLabel","muted","indicator","isVisibleTitleSegment","segment","fileName","isVisibleBlock","block","original","modified","items","questions","references","isVisibleItem","item","hasTitle","some","hasBlocks","mergeToolRenderers","overrides","getRenderer","toolRenderers","rawTool","key","renderer","renderInvocation","options","rendered","buildTimelineDocFromInvocations","invocations","ComponentProps","lazy","Suspense","Editor","then","module","default","DiffEditor","props","$","_c","t0","_c","Avatar","Timeline","ChakraTimeline","Span","getIconComponent","Indicator","IndicatorView","props","$","_c","ind","type","t0","icon","IndicatorIcon","t1","alt","src","Symbol","for","t2","_c","ChakraTimeline","Avatar","Link","Span","MouseEvent","DiffBubble","Tooltip","ChatLinkAnchor","useChatLinkHandler","TitleSegment","handleTitleLinkClick","event","HTMLAnchorElement","seg","Extract","kind","onOpenFile","filePath","stopPropagation","href","preventDefault","AvatarTitleSegment","t0","$","_c","t1","alt","src","t2","Symbol","for","t3","DiffTitleSegment","additions","deletions","fileName","path","t4","BubbleLinkTitleSegment","fontWeight","bold","undefined","isInteractive","Boolean","muted","t5","t6","textDecoration","color","t7","text","DefaultLinkTitleSegment","TextTitleSegment","isClickable","monospace","truncate","t8","t9","segment","t10","TitleInline","handler","source","origin","variant","_c","Tooltip","Box","Button","Card","Timeline","ChakraTimeline","Image","Span","Stack","Text","ChevronUpIcon","ReactNode","useState","DiffEditor","ResourceBadge","ScrollArea","ChatLinkProps","ChatLinkAnchor","ChatLinkProvider","useChatLinkHandler","IconName","IndicatorView","TitleInline","QuestionFormBlockView","TodoListBlockView","TimelineDoc","items","Item","id","timestamp","indicator","Indicator","title","TitleSegment","blocks","Block","expandable","type","icon","color","src","alt","kind","text","bold","muted","truncate","monospace","fileName","filePath","additions","deletions","href","variant","TodoListBlockItem","label","checked","QuestionFormBlockOption","description","QuestionFormBlockQuestion","question","options","multiple","required","allowCustomAnswer","reactions","clap","language","code","editable","original","modified","sideBySide","placeholder","questions","references","caption","render","ctx","onOpenFile","CodeBlock","t0","$","_c","t1","t2","t3","BlockView","b","map","_temp","trim","ref","source","origin","TimelineItemRow","item","itemKey","isOpen","canExpand","hasBlocks","onToggle","Symbol","for","t4","length","undefined","seg","i","t5","block","i_0","t6","t7","TimelineFromJSONProps","data","TimelineFromJSON","props","inherited","linkHandler","TimelineContent","handler","path","open","openFile","expanded","setExpanded","getKey","_temp2","key","prev","toggle","idx_0","key_0","idx","it","Timeline","ChakraTimeline","_c","ScrollArea","_temp","_Fragment","_temp2","ChatLinkProps","buildTimelineDocFromInvocations","normalizeToolName","ToolPart","TimelineFromJSON","ToolInvocationTimelineProps","invocations","labeledBlocks","hideQuestionForms","isQuestionTool","invocation","tool","replace","hasToolOutput","output","state","trim","length","Array","isArray","Object","keys","undefined","ToolInvocationTimeline","props","$","_c","t0","linkHandler","t1","t2","Symbol","for","bb0","visibleInvocations","filter","_temp","data","t3","_c","_temp","Box","Image","Spinner","ReactNode","AlertMessage","ResourceBadge","RichMessage","ChatImageSourcesContext","emptyChatImageSources","indexChatImageSources","useChatImageHistory","ChatLinkProps","ChatLinkProvider","useChatLinkHandler","parseQuestionPrompt","Response","ChatQuestionBubble","AlertPart","ChatMessagePart","ErrorPart","FilePart","SessionMessage","ToolPart","ToolInvocationTimeline","ToolInvocationTimelineProps","ToolInvocationTimelineComponent","props","MessagePartsProps","message","streaming","hideQuestionForms","toolInvocationTimeline","isToolPart","part","type","filePartLabel","filename","url","split","pop","imageExtensionPattern","isImageFilePart","mediaType","startsWith","test","filePartThumbnail","undefined","openFilePart","linkHandler","ChatLinkHandler","open","source","origin","window","getErrorMessage","trim","length","errorType","ALERT_COLOR_PALETTE","Record","info","warning","error","success","loading","collectToolInvocations","parts","startIndex","invocations","lookahead","nextPart","tool","state","input","push","nextIndex","MessagePartsRenderer","$","_c","inherited","t0","t1","t2","MessagePartsContent","imageHistory","localImages","RenderToolInvocationTimeline","t3","nodes","partIndex","key","id","bb0","get","text","color","fontSize","fontWeight","status","title","_c","_Fragment","SessionMessageRole","TextPart","type","text","ReasoningPart","ToolPartActionType","ToolPartStatus","ToolPart","tool","callId","actionType","status","state","input","output","errorText","metadata","StepStartPart","snapshot","StepFinishPart","reason","cost","tokens","PatchPart","hash","files","FilePart","fileId","mediaType","filename","size","url","LoadingPart","ErrorPart","errorType","message","TokenUsagePart","inputTokens","outputTokens","cacheReadTokens","cacheWriteTokens","AlertPart","title","SessionMessagePart","ChatMessagePart","SessionMessage","id","role","parts","index","createdAt","delivery","modelId","providerId","reasoning","cache","read","write","QueuedFollowUp","sending","revision","model","params","Record","steeringUnavailableReason","steeringDelivery","runStartedAt","prompt","attachments","Array","name","position","MessageOrigin","getMessageOrigin","isReasoningToolOnlyMessage","length","hasTextPart","some","part","isVisibleText","trim","isVisibleAlert","Boolean","isDisplayRenderablePart","isActivityPart","toLowerCase","isActivityOnlyMessage","every","mergeBufferedActivity","messages","first","rest","flatMap","at","mergeReasoningToolOnlyMessages","merged","previous","push","normalizeChatMessagesForDisplay","options","streaming","normalized","activityBuffer","clearActivityBuffer","displayParts","filter","displayMessage","activity","trailingActivity","MessageGroup","userMessage","responses","getAssistantMessageActionTargetId","lastMessage","hasVisibleText","groupMessagesByTurn","groups","leadingResponses","Button","Flex","useSlotRecipe","ReactNode","ChatMessage","messageFadeInProps","MessageActionPanel","MessagePartsRenderer","getMessageOrigin","SessionMessage","ChatMessageListResponseProps","message","streaming","hideQuestionForms","animate","showAssistantActions","ChatMessageListResponse","props","$","_c","t0","t1","undefined","t2","role","from","showActions","t3","t4","t5","t6","t7","t8","StickyMessageToggleProps","expanded","label","onClick","actionPanel","StickyMessageToggle","Symbol","for","key","recipe","styles","footer","_c","getAssistantMessageActionTargetId","MessageGroup","SessionMessage","ChatMessageRow","key","message","type","endIndex","userIndex","showAssistantActions","isActiveTurn","buildChatMessageRows","leadingResponses","groups","leadingActionId","rows","map","id","length","groupIndex","group","entries","actionId","responses","push","userMessage","getChatStickyRowIndex","index","row","hasChatRowGap","next","Boolean","SCROLL_BOUNDARY_EPSILON","StickyUserMessageScrollElement","clientHeight","scrollHeight","scrollTop","shouldStopStickyUserMessageWheel","element","deltaY","maxScrollTop","Math","max","Box","useSlotRecipe","useLayoutEffect","useRef","useState","WheelEvent","ScrollArea","ChatMessage","messageFadeInProps","StickyMessageToggle","shouldStopStickyUserMessageWheel","MessageActionPanel","MessagePartsRenderer","SessionMessage","StickyUserMessageProps","message","expanded","animate","onToggle","messageId","handleWheel","event","HTMLElement","currentTarget","deltaY","stopPropagation","StickyUserMessage","props","$","_c","viewportRef","bodyRef","previewRef","collapsible","setCollapsible","isExpanded","t0","Symbol","for","key","recipe","t1","styles","t2","t3","undefined","t4","viewport","css","onWheel","viewportProps","t5","t6","body","current","preview","measure","getBoundingClientRect","height","observer","ResizeObserver","observe","disconnect","t7","t8","scrollTop","t9","actions","t10","delivery","t11","t12","t13","t14","t15","t16","t17","id","t18","root","t19","_c","ScrollArea","useEffect","useLayoutEffect","useRef","TAIL_READY_STABLE_FRAME_COUNT","TAIL_READY_FRAME_LIMIT","TAIL_READY_PIXEL_EPSILON","TailLayoutSnapshot","scrollTop","totalSize","isTailLayoutStable","current","previous","Math","abs","tailFitsViewport","scrollElement","HTMLElement","Boolean","max","scrollHeight","clientHeight","readTailLayoutSnapshot","useTailReady","input","$","_c","itemCount","onReady","scrollRef","onReadyRef","t0","t1","t2","t3","requestAnimationFrame","frameId","checkedFrameCount","stableFrameCount","previousSnapshot","waitForStableTail","nextSnapshot","cancelAnimationFrame","_c","Box","defaultRangeExtractor","useStickToBottomContext","useVirtualizer","useMessageAnimationKeys","ChatMessageListResponse","buildChatMessageRows","getChatStickyRowIndex","hasChatRowGap","MessageGroup","SessionMessage","StickyUserMessage","useTailReady","ChatMessageListProps","leadingResponses","groups","streaming","hideActiveQuestionForms","expandedStickyMessageIds","Set","onToggleStickyMessage","messageId","onReady","ESTIMATED_MESSAGE_HEIGHT","VIRTUAL_LIST_OVERSCAN","VIRTUAL_LIST_GAP","ChatMessageList","props","scrollRef","rows","animatedKeys","map","row","key","initialHeight","current","clientHeight","gapCount","Math","max","length","virtualizer","virtualItems","totalSize","measurements","HTMLDivElement","count","getScrollElement","estimateSize","index","getItemKey","overscan","initialRect","width","height","initialOffset","rangeExtractor","range","indexes","stickyIndex","startIndex","includes","unshift","itemCount","virtualItem","type","end","endIndex","top","start","size","measureElement","undefined","message","has","isActiveTurn","showAssistantActions","useVirtualizer","useEffect","useState","PromptSelectionSnapshot","createSerializedPromptState","ChatInputQuestionResponse","QueuedFollowUp","QueuedFollowUpComposerInput","queuedFollowUps","defaultValue","onChange","text","onSubmit","attachments","questionResponse","Promise","onUpdate","itemId","prompt","onCreate","onRestoreDraft","canRestoreDraft","disabled","onSelect","item","onDiscard","useQueuedFollowUpComposer","input","editingItem","setEditingItem","edits","setEdits","Record","state","draftState","setDraftState","focusSignal","setFocusSignal","selections","setSelections","error","setError","updating","setUpdating","recoveredItemId","setRecoveredItemId","notice","setNotice","savedItem","find","id","createNew","Boolean","stale","revision","inputValue","savedDraftState","undefined","editorState","select","signal","trim","length","current","draft","next","change","changeState","discard","submit","Error","failure","message","selectionKey","initialSelection","changeSelection","selection","draftValue","edit","selectDraft","editingItemId","isEditing","dirtyItemIds","Object","keys","filter","Box","Button","Text","createSerializedPromptState","ChatInput","ChatPanelComposerProps","QueuedComposerInputProps","editing","hasQueuedFollowUps","QueuedComposerInput","props","$","_c","conversationKey","recentUserMessages","actions","attachmentActions","attachedResources","attachmentList","chatInputAutoFocus","chatInputPlaceholder","chatInputQuestionPrompt","composerDecision","chatInputCommands","inputDisabled","submitDisabled","onAttachFiles","onAttachText","onClearAttachments","onInterrupt","queuedComposer","streaming","actionLabel","createNew","updateLabel","updating","t0","event","key","defaultPrevented","nativeEvent","isComposing","currentTarget","contains","target","Node","preventDefault","stopPropagation","discard","t1","editingItemId","t2","editorState","inputValue","t3","t4","undefined","t5","t6","t7","stale","t8","t9","t10","t11","change","changeSelection","changeState","focusSignal","initialSelection","submit","t12","t13","QueuedComposerNotice","notice","error","failure","Boolean","_c","Box","Text","useSlotRecipe","KeyboardCoordinateGetter","useDroppable","ArrowUp","queuedFollowUpRecipe","QueuedFollowUp","queueKeyboardCoordinates","event","KeyboardEvent","context","Parameters","onTarget","id","keys","includes","code","undefined","preventDefault","targets","droppableContainers","getEnabled","sort","a","b","Number","data","current","order","index","findIndex","target","over","next","length","Math","max","min","rect","droppableRects","get","x","left","width","collisionRect","y","top","height","QueueDropZone","props","item","kind","drop","disabled","Boolean","sending","steeringDelivery","indexOf","position","before","combine","after","bottom","setNodeRef","QueueSendNow","visible","targeted","reason","styles","recipe","sendNowHit","sendNow","Box","HStack","IconButton","Stack","Text","useSlotRecipe","useDraggable","GripVertical","Trash2","ReactNode","useEffect","useRef","useState","DropIndicator","queuedFollowUpRecipe","QueuedFollowUp","QueueDropZone","QueuedFollowUpRowProps","item","index","editor","source","destination","unavailableReason","editing","onEdit","onRemove","id","QueuedFollowUpRow","props","disabled","Boolean","sending","steeringDelivery","drag","data","styles","recipe","hovered","setHovered","focused","setFocused","exit","ReturnType","setTimeout","undefined","row","HTMLDivElement","clearTimeout","current","scrollIntoView","block","reveal","compact","node","setNodeRef","event","pointerType","currentTarget","contains","relatedTarget","target","Element","closest","setActivatorNodeRef","listeners","attributes","handle","stopPropagation","content","prompt","model","Object","values","params","map","String","attachments","attachment","name","filter","join","notice","actions","Box","Text","useSlotRecipe","DndContext","KeyboardSensor","PointerSensor","pointerWithin","rectIntersection","useSensor","useSensors","Fragment","ReactNode","useState","ScrollArea","queuedFollowUpRecipe","QueuedFollowUp","QueueSendNow","queueKeyboardCoordinates","QueuedFollowUpMoveDirection","QueuedFollowUpRow","QueuedFollowUpListProps","items","editingItemId","editor","retainedEditor","retainedEditorPosition","dirtyItemIds","steeringUnavailableReason","onEdit","item","onRemove","itemId","onMove","direction","steps","selection","source","Promise","onSteer","onCombine","target","settingsKey","JSON","stringify","model","Object","entries","params","sort","a","b","localeCompare","QueuedFollowUpList","props","$","_c","t0","t1","undefined","t2","Symbol","for","recipe","t3","t4","styles","keyboardTarget","setKeyboardTarget","t5","activationConstraint","distance","t6","coordinateGetter","event","context","sensors","setSource","t7","dragItems","setDragItems","destination","setDestination","error","setError","pending","setPending","length","t8","getRetainedEditorIndex","retainedIndex","t9","includes","id","steerReason","showSendNow","Boolean","t10","steeringDelivery","combineReason","t11","selected","target_0","kind","eligible","filter","_temp","start","findIndex","item_0","end","item_1","insertion","next","Math","abs","reorder","t12","selected_0","target_1","performDrop","t13","args","pointerCoordinates","pointer","t14","event_0","active","data","current","t15","t16","event_1","over","t17","event_2","selected_1","target_2","resolve","then","catch","failure","Error","message","finally","t18","root","t19","t20","t21","maxH","t22","t23","item_2","index","map","t24","t25","notice","t26","t27","position","Number","POSITIVE_INFINITY","RetainedEditor","children","row","sending","_c","_temp","Fragment","ScrollArea","Box","Stack","useSlotRecipe","ReactNode","chatComposerRecipe","queuedFollowUpRecipe","useQueuedFollowUpComposer","PromptCommand","ChatInputQuestionPrompt","ComposerDecision","QueuedFollowUp","QueuedComposerInput","QueuedFollowUpList","QueuedFollowUpMoveDirection","ChatPanelComposerProps","conversationKey","recentUserMessages","actions","attachmentActions","composerHeader","attachedResources","attachmentList","chatInputAutoFocus","chatInputPlaceholder","chatInputQuestionPrompt","composerDecision","chatInputCommands","hasWorkspaceHub","inputDisabled","submitDisabled","onAttachFiles","files","File","onAttachText","text","onClearAttachments","onInterrupt","onQueuedFollowUpMove","itemId","direction","steps","selection","source","items","onQueuedFollowUpRemove","onQueuedFollowUpUpdate","prompt","Promise","onQueuedFollowUpSteer","item","onQueuedFollowUpCombine","target","queueSteeringUnavailableReason","unsavedQueueItemIds","queuedComposer","ReturnType","queuedFollowUps","streaming","workspaceHub","ChatPanelComposer","props","$","_c","t0","t1","undefined","t2","Symbol","for","recipe","t3","t4","styles","t5","t6","t7","workspace","composerStyles","hasQueuedFollowUps","length","editing","isEditing","t8","editor","t9","t10","createNew","t11","editingItem","position","t12","dirtyItemIds","t13","edit","t14","editingItemId","t15","draftValue","selectDraft","draft","t16","_c","HStack","Spinner","Text","useEffect","useState","formatElapsed","totalSeconds","seconds","Math","max","floor","minutes","String","padStart","hours","WorkingIndicator","props","$","_c","startedAt","hidden","t0","undefined","mountedAt","Date","now","setNow","t1","t2","updateElapsed","timer","setInterval","clearInterval","t3","Symbol","for","t4","t5","t6","_c","Box","Flex","MessageCircleIcon","ReactNode","useState","EmptyState","PromptCommand","ChatImageHistoryContext","indexChatImageSources","ChatLinkProps","ChatLinkProvider","resolveActiveQuestionPrompt","ChatPrimitives","AutoScroll","getRecentUserPrompts","ChatInputQuestionPrompt","ChatInputQuestionResponse","ChatMessageList","ChatPanelComposer","useQueuedFollowUpComposer","ChatQuestionNavigationContext","useChatQuestionNavigation","ComposerDecision","groupMessagesByTurn","normalizeChatMessagesForDisplay","QueuedFollowUp","SessionMessage","QueuedFollowUpMoveDirection","WorkingIndicator","ChatPanelProps","conversationKey","messages","loading","streaming","streamingStartedAt","emptyStateTitle","emptyStateDescription","emptyStateContent","loaderComponent","chatInputPlaceholder","chatInputDefaultValue","onSubmitMessage","text","attachments","questionResponse","Promise","onInterrupt","onAttachFiles","files","File","onAttachText","onChatInputChange","actions","attachmentActions","composerHeader","attachedResources","onClearAttachments","attachmentList","approvalPrompt","conversationNotices","workspaceHub","workspaceInitializing","inputDisabled","submitDisabled","chatInputQuestionPrompt","composerDecision","chatInputAutoFocus","queuedFollowUps","onQueuedFollowUpUpdate","itemId","prompt","onQueuedFollowUpCreate","onQueuedFollowUpRestoreDraft","canRestoreQueuedEditToDraft","onQueuedFollowUpSelect","item","onQueuedFollowUpDiscard","onQueuedFollowUpSteer","onQueuedFollowUpCombine","source","target","queueSteeringUnavailableReason","unsavedQueueItemIds","onQueuedFollowUpRemove","onQueuedFollowUpMove","direction","steps","selection","items","chatInputCommands","ChatPanel","props","$","_c","linkHandler","t0","t1","t2","t3","t4","t5","t6","t7","t8","undefined","t9","t10","hasMessages","messageListIdentity","messageListKey","t11","userMessageCount","merged","length","id","reduce","_temp","groups","leadingResponses","expandedStickyMessageIds","setExpandedStickyMessageIds","_temp2","readyMessageListKey","setReadyMessageListKey","showLoadingState","t12","Symbol","for","t13","defaultEmptyContent","emptyContent","hasWorkspaceHub","Boolean","questionNavigation","t14","activeQuestionPrompt","hideActiveQuestionForms","showThinkingIndicator","isMessageViewportReady","t15","defaultValue","onChange","onSubmit","onUpdate","onCreate","onRestoreDraft","canRestoreDraft","disabled","onSelect","onDiscard","queuedComposer","t16","messageId","current","next","Set","has","delete","add","toggleStickyMessageExpanded","t17","t18","value","t19","t20","t21","t22","t23","t24","t25","t26","t27","t28","t29","t30","t31","t32","t33","t34","t35","count","message","role","_c","_temp","EmptyState","defaultEmptyContent","_Fragment","Skeleton","Stack","ChatMessage","SkeletonLinesProps","widths","SkeletonLines","props","$","_c","t0","map","_temp","t1","ChatSkeleton","Symbol","for","width","index","_c","Box","chakra","Flex","Portal","Stack","Text","PointerEvent","useState","ConversationBrowseItem","id","message","reply","ConversationBrowseProps","items","onSelect","floating","MIN_USER_MESSAGES","TICK_MIN_WIDTH","TICK_MAX_WIDTH","LENS_RADIUS","BrowseCardPosition","left","top","lensFactor","index","pointerIndex","distance","Math","abs","cos","PI","tickColor","ConversationBrowseCard","props","$","_c","item","position","t0","t1","t2","t3","t4","t5","ConversationBrowse","undefined","setPointerIndex","cardPosition","setCardPosition","length","event","rect","currentTarget","getBoundingClientRect","fraction","clientY","height","next","min","max","nextActiveIndex","round","right","handlePointerMove","activeIndex","activeItem","Symbol","for","insetInlineStart","bottom","bg","map","t6","t7","_c","Button","chakra","Field","HStack","Icon","Input","Menu","Popover","Portal","Stack","Tag","Text","useSlotRecipe","useState","ListRow","getIconComponent","Tooltip","HarnessAction","id","label","icon","argument","value","HarnessMode","description","state","indicator","tone","tagText","closeActionId","confirmation","title","actionId","cancelLabel","actions","LocalTag","onClose","closeLabel","HarnessControlsProps","modes","draftTag","sentTag","pending","unavailable","onRequestConfirmation","modeId","onAction","modeSnapshot","Promise","LocalModeTag","props","$","_c","tag","t0","t1","t2","t3","t4","t5","t6","NativeModeTag","mode","Symbol","for","key","styles","editing","setEditing","setArgument","open","setOpen","action","find","closeAction","action_0","undefined","invoke","status","placement","details","t7","t8","t9","t10","t11","t12","t13","t14","t15","t16","t17","t18","event","target","trim","t19","t20","map","action_1","t21","content","t22","HarnessControls","_c","Tooltip","getIconComponent","Flex","HStack","Spinner","Text","AlertTriangle","ReactNode","WorkspaceHubStatus","ChatWorkspaceHubProps","workspaceControl","additions","deletions","action","status","statusLabel","HubStatus","props","$","_c","t0","Symbol","for","t1","t2","ChatWorkspaceHub","undefined","t3","t4","_c","AlertMessage","Tooltip$1","ScrollArea$1","ListRow","useVirtualizer$1","ResourceBadge","Checkbox$1","DropIndicator","EmptyState$1","getIconComponent$1","RadioGroup$1","Radio","chatQuestionBubbleRecipe","queuedFollowUpRecipe","ChatLinkAnchor","ChatImageSourcesContext","useChatImageHistory","useChatLinkHandler","parseChatLink","ChatImageHistoryContext","indexChatImageSources","ChatLinkProvider","emptyChatImageSources","generateEditorStateFromString","getTextFromSerializedEditorState","RichMessage","PromptEditor","DiffBubble","Fragment$1","useConversationVisibility","$","c","useStickToBottomContext","t0","t1","scrollRef","scrollToBottom","stopScroll","viewport","hidden","position","frame","rememberPosition","observer","saved","useLayoutEffect","ConversationRoot","chakra","StickToBottom","ConversationContent","children","rest","props","contentRef","t2","t3","t4","conversationScrollButtonContainerDefaultProps","ChatPrimitives","isAtBottom","AbsoluteCenter","IconButton","ArrowDownIcon","recipe","defineSlotRecipe","createSlotRecipeContext","ChatMessage","withProvider","withContext","formatToolInput","input","text","ApprovalPrompt","toolInput","formattedInput","toolName","Text","Code","ShieldX","onDeny","Button","t5","ShieldCheck","t6","onApprove","t7","HStack","t8","Box","Flex","DEFAULT_SIZE","DEFAULT_TONE","AttachmentList","attachments","size","tone","onRemove","onSelect","renderBadge","select","attachment","remove","rendered","Stack","shouldAutoScroll","args","previousUserMessageCount","userMessageCount","getNextAutoScrollState","conversationKey","scrollForNextAutoScrollState","next","AutoScroll","stateRef","useRef","useEffect","chatComposerRecipe","createSerializedPromptState","hasMessageText","resolveChatInputKeyboardAction","state","isDisabled","canSubmit","resolveChatInputButtonAction","streaming","hasQuestionPrompt","canInterrupt","shouldAttachPastedText","lineThreshold","createAttachmentEventHandlers","onAttachFiles","event","files","pastedText","onAttachText","textAttachmentPasteLineThreshold","SendButton","shortcut","title","ariaLabel","Pause","ArrowUp","icon","button","Fragment","Kbd","tooltipContent","Tooltip","Portal","ChatInputToolbar","actions","onSkip","questionPrompt","skipDisabled","skipTitle","buttonAction","messageTitle","runAction","submitLabel","submitTitle","submitActions","submitComposerResponse","OTHER_CHOICE_LABEL","OTHER_CHOICE_VALUE","getOwnQuestionValue","values","key","questionOffersOtherChoice","question","getQuestionSelectionKey","index","isQuestionOtherSelected","customAnswersByQuestion","questionIndex","clearQuestionOtherAnswer","_removed","toggleQuestionOtherAnswer","SKIPPED_QUESTION_TEXT","toQuestionResponse","buildSkippedQuestionResponse","toggleQuestionOptionSelection","selected","selectedOptionsByQuestion","alreadySelected","optionLabel","label","getQuestionPromptSignature","option","answersForQuestion","typed","customAnswer","selectedLabels","getAnswersForQuestion","getQuestionAnswerLines","lines","answers","isCustomAnswersByQuestion","value","toCustomAnswersByQuestion","answerInput","trimmed","buildQuestionResponse","legacyText","hasCustomQuestions","buildQuestionAnswerValues","hasMissingRequiredQuestionAnswer","hasQuestionAnswer","QuestionStepTab","isAnswered","stepStateLabel","tabVariant","isActive","onSelectStep","Check","isRecord","parseJsonObjectText","parsed","toInputRecord","getStringValue$2","getQuestionResponseText","stringValue","line","carriesAnswers","hasQuestionResponse","parseQuestionOption","parseQuestion","options","type","declaredCustomAnswer","allowCustomAnswer","parseQuestionPrompt","record","questions","isQuestionTool$1","part","orderedQuestionRequests","requests","message","messages","getQuestionRequestKey","isPendingQuestion","questionPromptFor","prompt","resolveQuestionPrompt","resolveActiveQuestionPrompt","getQuestionBubbleAnswer","answer","section","ChatQuestionNavigationContext","createContext","useQuestionNavigation","useContext","useChatQuestionNavigation","selection","setSelection","useState","current","previous","previous_0","index_0","preventSubmit","QuestionOptionContent","QuestionCheckboxOptionRow","editable","onToggle","checked","name","QuestionRadioOptions","hasOtherChoice","selectedOption","selectedIndex","otherSelected","onToggleOption","onToggleOther","details","optionIndex","option_0","otherField","t9","TodoListBlockView","items","_temp$6","QuestionOtherField","editablePlaceholder","onCustomAnswerChange","Textarea","QuestionCheckboxOptions","selectedOptions","QuestionFieldset","hasChoices","QuestionFormBlockView","item","toQuestionFormQuestions","QuestionPromptStepper","activeQuestionIndex","setActiveQuestionIndex","questionPanelRef","navigation","focusRevision","selectStep","renderQuestionIndex","activeQuestion","hasMultipleQuestions","question_0","hadSelection","t10","t11","t12","isEditable","t13","t14","QuestionPromptControls","questionPromptSignature","defaultSelections","useQuestionPromptState","setSelectedOptionsByQuestion","setCustomAnswersByQuestion","signature","previousResetRef","resetToken","custom","current_0","current_1","current_2","questionIndex_0","current_3","question_1","questionIndex_1","current_4","ChatInputQuestionForm","submitting","setSubmitting","inFlight","disabled","onSubmit","skip","sent","response","submit","action","ComposerDecisionToolbar","choose","decision","actionId","action_0","ComposerTakeover","request","submitDisabled","useComposerFocus","requested","setRequested","autoFocus","focusSignal","source","setSource","getRecentUserPrompts","prompts","i","movePromptHistory","count","direction","useChatInputHistory","editorRef","historyIndex","blocked","recentUserMessages","resetKey","resetSignature","previousResetSignature","reset","onChange","change","movement","value_0","recall","useChatInputText","adoptedState","setAdoptedState","defaultState","editorState","setEditorState","editorKey","setEditorKey","setText","_temp$5","remountEditor","nextText","resolveComposerRequest","waiting","active","useComposerRequest","setActive","ChatInputPlaceholder","placeholder","ChatInput","occupied","styles","useSlotRecipe","focus","history","handleContainerClick","target","replaceDraftText","actionState","onInterrupt","submitMessage","sentText","retainTextUntilAcknowledged","attachedResources","attachmentEventHandlers","attachmentList","onEditorStateChange","attachmentActions","messageFadeInProps","getNextMessageAnimationState","animatedKeys","seenKeys","itemKeysEqual","a","b","useMessageAnimationKeys","lastResultRef","itemKeys","isCopyablePart","getMessageCopyText","getMessageTimestampLabel","locale","MessageActionPanel","alwaysVisible","copyAlwaysVisible","isCopied","setIsCopied","copyResetTimeoutRef","copyText","timestampLabel","copyMessage","messageActionPanelHoverStyles","jsx","Copy","Response","linkHandler","ChatQuestionBubble","useRecipe","pending","canOpen","T0","expanded","ArrowRight","normalizeToolName","getToolNameLookupKeys","normalized","compact","toolIconMap","Terminal","ListTree","FileText","FilePen","Trash2","FileDiff","FileUp","FileDown","Move","iconMap","DotIcon","AlertTriangle","Search","Globe","File","CircleQuestionMark","ListTodo","DEFAULT_TOOL_ICON","isToolIconName","getIconComponent","toolTypeToIconName","basenameSafe","idx","path","normalizeHeaderPath","token","isMinusHeader","isPlusHeader","isHunkHeader","isAddedLine","isDeletedLine","ensureFileChange","changes","filePath","incrementAdditions","incrementDeletions","processUnifiedDiffLine","currentPath","parseUnifiedDiff","diffText","buildDiffTitleSegments","file","extractDiffFilePaths","isDiffFileBoundary","isInvalidHunkBodyLine","appendHunkLine","original","modified","parseHunkBody","startIndex","parsePreview","oldHeader","buildFileDiffPreviews","previews","preview","nextIndex","TOOL_LABELS","STATE_LABELS$1","normalizeToolType","toTitleCase$1","getToolType","invocation","getToolLabel$1","getStateLabel$1","isErrorState$1","buildIndicator$1","buildBaseTitle","labelOverride","detail","detailStyle","stateLabel","getInputObject","getOutputObject","output","getStringValue$1","getObjectValue$1","getStateObject","normalizeFilePath","isUnifiedDiff","getApplyPatchMetadataObjects","parseApplyPatchMetadataFile","entry","rawPath","getApplyPatchMetadataFiles","metadata","entries","parsedFile","getApplyPatchInputFilePaths","filePaths","getApplyPatchDiffText","inputDiff","metadataDiff","fileDiffs","diff","patchText","buildApplyPatchMetadataTitleSegments","seen","segments","getApplyPatchMetadataReferences","getOutputText","outputObject","parseSkillContentBlock","match","getSkillName","buildFileLinkSegment","variant","prependErrorBlock","blocks","getDiffBlocks","getDiffTitleSegments","getDiffReferences","renderApplyPatch","metadataFiles","inputFilePaths","diffSegments","references","buildEditDiff","renderEdit","diffBlocks","createQuestionRenderer","deps","responded","block","fieldLabel","buildIndicator","renderRead","renderCommand","outputText","stderr","renderBash","renderShell","renderGrep","renderGlob","renderSkill","parsedOutput","renderedContent","getStringValue","getObjectValue","parseTodoItem","todo","content","parseTodoItems","listSource","objectValue","createTodowriteRenderer","inputTodos","outputTodos","todoState","todos","countLabel","renderQuestion","renderTodowrite","createDefaultToolRenderers","STATE_LABELS","toTitleCase","getToolLabel","tool","isErrorState","getStateLabel","stringifyValue","isBlankValue","getRecord","getString","getMediaType","isImageMediaType","imageUrlPattern","getImageBlock","mediaType","data","url","getFileLikeOutput","extensionLanguageBySuffix","getLanguageFromPath","extension","createLabeledBlocks","buildBlocksForArrayValue","entryRecord","entryType","image","alt","buildBlocksForValue","buildBlocksForFileLikeValue","fileLikeOutput","buildBlocksForAttachmentValue","attachmentName","attachmentId","imageBlock","fileBlocks","attachmentBlocks","buildGenericBlocks","toolLabel","createGenericItem","isVisibleTitleSegment","segment","isVisibleBlock","isVisibleItem","hasTitle","hasBlocks","mergeToolRenderers","overrides","getRenderer","rawTool","renderer","toolRenderers","renderInvocation","buildTimelineDocFromInvocations","invocations","Editor","lazy","n","module","DiffEditor","Suspense","IndicatorView","ind","IndicatorIcon","Timeline","Span","Avatar","handleTitleLinkClick","stopPropagation","seg","onOpenFile","AvatarTitleSegment","DiffTitleSegment","BubbleLinkTitleSegment","fontWeight","isInteractive","Link","DefaultLinkTitleSegment","TextTitleSegment","isClickable","TitleInline","Timeline$1","CodeBlock","language","code","BlockView","Card","_temp$4","Image","ref","TimelineItemRow","isOpen","canExpand","itemKey","ChevronUpIcon","i_0","TimelineFromJSON","inherited","TimelineContent","handler","openFile","setExpanded","getKey","_temp2$1","prev","toggle","key_0","idx_0","it","isQuestionTool","hasToolOutput","ToolInvocationTimeline","hideQuestionForms","labeledBlocks","visibleInvocations","_temp$3","isToolPart","filePartLabel","imageExtensionPattern","isImageFilePart","filePartThumbnail","openFilePart","getErrorMessage","errorType","ALERT_COLOR_PALETTE","collectToolInvocations","lookahead","parts","nextPart","MessagePartsRenderer","MessagePartsContent","imageHistory","toolInvocationTimeline","localImages","RenderToolInvocationTimeline","nodes","partIndex","Spinner","getMessageOrigin","role","isVisibleText","isVisibleAlert","isDisplayRenderablePart","isActivityPart","isActivityOnlyMessage","mergeBufferedActivity","first","normalizeChatMessagesForDisplay","activityBuffer","clearActivityBuffer","displayParts","displayMessage","activity","trailingActivity","getAssistantMessageActionTargetId","lastMessage","groupMessagesByTurn","groups","leadingResponses","ChatMessageListResponse","animate","from","showActions","showAssistantActions","StickyMessageToggle","onClick","actionPanel","buildChatMessageRows","leadingActionId","rows","groupIndex","group","userIndex","getChatStickyRowIndex","row","hasChatRowGap","SCROLL_BOUNDARY_EPSILON","shouldStopStickyUserMessageWheel","maxScrollTop","element","deltaY","handleWheel","StickyUserMessage","viewportRef","bodyRef","previewRef","collapsible","setCollapsible","isExpanded","viewportProps","body","measure","t15","t16","t17","t18","t19","TAIL_READY_STABLE_FRAME_COUNT","TAIL_READY_FRAME_LIMIT","TAIL_READY_PIXEL_EPSILON","isTailLayoutStable","tailFitsViewport","scrollElement","totalSize","readTailLayoutSnapshot","useTailReady","onReadyRef","onReady","itemCount","frameId","checkedFrameCount","stableFrameCount","previousSnapshot","waitForStableTail","nextSnapshot","ESTIMATED_MESSAGE_HEIGHT","VIRTUAL_LIST_OVERSCAN","VIRTUAL_LIST_GAP","ChatMessageList","initialHeight","gapCount","indexes","defaultRangeExtractor","range","stickyIndex","virtualItems","row_0","virtualItem","end","measurements","virtualizer","expandedStickyMessageIds","onToggleStickyMessage","hideActiveQuestionForms","useQueuedFollowUpComposer","editingItem","setEditingItem","edits","setEdits","draftState","setDraftState","setFocusSignal","selections","setSelections","error","setError","updating","setUpdating","recoveredItemId","setRecoveredItemId","notice","setNotice","savedItem","queuedFollowUps","createNew","stale","inputValue","defaultValue","savedDraftState","item_0","signal","canRestoreDraft","onRestoreDraft","signal_0","changeState","text_0","discard","onDiscard","next_0","questionResponse","text_1","onCreate","onUpdate","next_1","failure","selectionKey","current_5","item_1","id","item_2","QueuedComposerInput","actionLabel","queuedComposer","updateLabel","editing","inputDisabled","hasQueuedFollowUps","chatInputAutoFocus","chatInputCommands","chatInputPlaceholder","chatInputQuestionPrompt","composerDecision","onClearAttachments","QueuedComposerNotice","queueKeyboardCoordinates","targets","context","rect","onTarget","QueueDropZone","drop","useDroppable","kind","QueueSendNow","visible","reason","targeted","QueuedFollowUpRow","drag","useDraggable","hovered","setHovered","focused","setFocused","exit","reveal","editor","node","destination","unavailableReason","event_0","event_1","onEdit","event_2","GripVertical","event_3","settingsKey","QueuedFollowUpList","dirtyItemIds","keyboardTarget","setKeyboardTarget","sensors","useSensors","useSensor","PointerSensor","KeyboardSensor","dragItems","setDragItems","setDestination","setPending","retainedEditor","retainedEditorPosition","getRetainedEditorIndex","retainedIndex","onSteer","steeringUnavailableReason","steerReason","showSendNow","combineReason","onMove","eligible","_temp$2","start","target_0","insertion","reorder","onCombine","target_1","selected_0","performDrop","pointer","pointerWithin","rectIntersection","selected_1","target_2","t20","t21","t22","editingItemId","t23","RetainedEditor","t24","t25","t26","t27","DndContext","ChatPanelComposer","unsavedQueueItemIds","hasWorkspaceHub","composerStyles","onQueuedFollowUpUpdate","onQueuedFollowUpCombine","onQueuedFollowUpMove","onQueuedFollowUpRemove","onQueuedFollowUpSteer","queueSteeringUnavailableReason","composerHeader","workspaceHub","formatElapsed","seconds","totalSeconds","minutes","WorkingIndicator","mountedAt","now","setNow","updateElapsed","timer","startedAt","ChatPanel","loading","chatInputDefaultValue","workspaceInitializing","hasMessages","messageListIdentity","messageListKey","merged","_temp$1","setExpandedStickyMessageIds","_temp2","readyMessageListKey","setReadyMessageListKey","showLoadingState","MessageCircleIcon","emptyStateDescription","emptyStateTitle","emptyContent","loaderComponent","emptyStateContent","questionNavigation","activeQuestionPrompt","showThinkingIndicator","isMessageViewportReady","canRestoreQueuedEditToDraft","onChatInputChange","onQueuedFollowUpCreate","onQueuedFollowUpDiscard","onQueuedFollowUpRestoreDraft","onQueuedFollowUpSelect","onSubmitMessage","messageId","toggleStickyMessageExpanded","conversationNotices","streamingStartedAt","t28","t29","t30","t31","approvalPrompt","t32","t33","t34","t35","SkeletonLines","widths","_temp","ChatSkeleton","Skeleton","width","MIN_USER_MESSAGES","TICK_MIN_WIDTH","LENS_RADIUS","lensFactor","pointerIndex","distance","tickColor","ConversationBrowseCard","ConversationBrowse","floating","setPointerIndex","cardPosition","setCardPosition","fraction","nextActiveIndex","handlePointerMove","activeIndex","activeItem","LocalModeTag","tag","Menu","Tag","NativeModeTag","setEditing","argument","setArgument","open","setOpen","mode","closeAction","onAction","modeSnapshot","invoke","status","unavailable","Popover","Field","Input","onRequestConfirmation","action_1","Icon","HarnessControls","modes","draftTag","sentTag","HubStatus","statusLabel","additions","deletions","ChatWorkspaceHub","workspaceControl"],"sources":["../src/components/chat-ui/components/use-conversation-visibility.ts","../src/components/chat-ui/components/ai-conversation.tsx","../src/components/chat-ui/components/ai-message.tsx","../src/components/chat-ui/components/approval-prompt.tsx","../src/components/chat-ui/components/attachment-list.tsx","../src/components/chat-ui/components/auto-scroll.tsx","../src/theme/recipes/chat-composer.ts","../src/components/chat-ui/utils/editor-state.ts","../src/components/chat-ui/components/chat-input-actions.ts","../src/components/chat-ui/components/chat-input-attachments.ts","../src/components/chat-ui/components/send-button.tsx","../src/components/chat-ui/components/chat-input-toolbar.tsx","../src/components/chat-ui/components/composer-decision.ts","../src/components/chat-ui/components/question-choices.ts","../src/components/chat-ui/components/chat-input-question-answers.ts","../src/components/chat-ui/components/chat-input-question-step-tab.tsx","../src/components/chat-ui/tool-rendering/question-prompt.ts","../src/components/chat-ui/components/chat-question-navigation.tsx","../src/components/chat-ui/components/timeline-tool-blocks.tsx","../src/components/chat-ui/components/chat-input-question-prompt.tsx","../src/components/chat-ui/components/use-question-prompt-state.ts","../src/components/chat-ui/components/chat-input-question-form.tsx","../src/components/chat-ui/components/composer-decision-toolbar.tsx","../src/components/chat-ui/components/composer-takeover.tsx","../src/components/chat-ui/components/use-chat-input-focus.ts","../src/components/chat-ui/components/chat-input-history.ts","../src/components/chat-ui/components/use-chat-input-history.ts","../src/components/chat-ui/components/use-chat-input-text.ts","../src/components/chat-ui/components/composer-request.ts","../src/components/chat-ui/components/use-composer-request.ts","../src/components/chat-ui/components/chat-input.tsx","../src/components/chat-ui/components/chat-message-animation.ts","../src/components/chat-ui/components/message-action-panel.tsx","../src/components/chat-ui/components/ai-response.tsx","../src/components/chat-ui/components/chat-question-bubble.tsx","../src/components/chat-ui/utils/tool-name.ts","../src/components/chat-ui/utils/get-icon.ts","../src/components/chat-ui/utils/diff.ts","../src/components/chat-ui/tool-rendering/shared.ts","../src/components/chat-ui/tool-rendering/apply-patch-renderer.ts","../src/components/chat-ui/tool-rendering/edit-renderer.ts","../src/components/chat-ui/tool-rendering/question-renderer.ts","../src/components/chat-ui/tool-rendering/standard-renderers.ts","../src/components/chat-ui/tool-rendering/todowrite-renderer.ts","../src/components/chat-ui/tool-rendering/default-renderers.ts","../src/components/chat-ui/tool-rendering/build-timeline.ts","../src/components/diff-viewer/lazy-diff-editor.tsx","../src/components/chat-ui/components/timeline-indicator.tsx","../src/components/chat-ui/components/timeline-title.tsx","../src/components/chat-ui/components/timeline.tsx","../src/components/chat-ui/components/tool-invocation-timeline.tsx","../src/components/chat-ui/components/message-parts-renderer.tsx","../src/components/chat-ui/components/message-types.ts","../src/components/chat-ui/components/chat-message-list-items.tsx","../src/components/chat-ui/components/chat-message-rows.ts","../src/components/chat-ui/components/chat-panel-sticky-user-message.ts","../src/components/chat-ui/components/sticky-user-message.tsx","../src/components/chat-ui/components/use-chat-tail-ready.ts","../src/components/chat-ui/components/chat-message-list.tsx","../src/components/chat-ui/components/use-queued-follow-up-composer.ts","../src/components/chat-ui/components/queued-composer-input.tsx","../src/components/chat-ui/components/queued-follow-up-drag.tsx","../src/components/chat-ui/components/queued-follow-up-row.tsx","../src/components/chat-ui/components/queued-follow-up-list.tsx","../src/components/chat-ui/components/chat-panel-composer.tsx","../src/components/chat-ui/components/working-indicator.tsx","../src/components/chat-ui/components/chat-panel.tsx","../src/components/chat-ui/components/chat-skeleton.tsx","../src/components/chat-ui/components/conversation-browse.tsx","../src/components/chat-ui/components/harness-controls.tsx","../src/components/chat-ui/components/workspace-hub.tsx"],"sourcesContent":["import { useLayoutEffect } from \"react\";\nimport { useStickToBottomContext } from \"use-stick-to-bottom\";\n\n// Temporary library limitation: documentation/adrs/0075-temporary-hidden-conversation-scroll-restoration.md.\nexport const useConversationVisibility = () => {\n const { scrollRef, stopScroll, scrollToBottom } = useStickToBottomContext();\n useLayoutEffect(() => {\n const viewport = scrollRef.current;\n if (!viewport) return;\n let hidden = false;\n let position = { top: viewport.scrollTop, atTail: true };\n let frame = 0;\n const rememberPosition = () => {\n if (hidden || viewport.getClientRects().length === 0) return;\n position = {\n top: viewport.scrollTop,\n atTail: viewport.scrollHeight - viewport.clientHeight - viewport.scrollTop < 3,\n };\n };\n const observer = new ResizeObserver(() => {\n const isHidden = viewport.getClientRects().length === 0;\n if (isHidden) {\n hidden = true;\n stopScroll();\n } else if (hidden) {\n hidden = false;\n const saved = position;\n stopScroll();\n viewport.scrollTop = saved.top;\n frame = requestAnimationFrame(() => {\n if (saved.atTail) void scrollToBottom(\"instant\");\n else viewport.scrollTop = saved.top;\n });\n }\n });\n viewport.addEventListener(\"scroll\", rememberPosition);\n observer.observe(viewport);\n return () => {\n cancelAnimationFrame(frame);\n observer.disconnect();\n viewport.removeEventListener(\"scroll\", rememberPosition);\n };\n }, [scrollRef, stopScroll, scrollToBottom]);\n};\n","import type { HTMLChakraProps, IconButtonProps } from \"@chakra-ui/react\";\nimport { AbsoluteCenter, chakra, IconButton } from \"@chakra-ui/react\";\nimport { ArrowDownIcon } from \"lucide-react\";\nimport { StickToBottom as StickToBottomEl, useStickToBottomContext } from \"use-stick-to-bottom\";\nimport { ScrollArea } from \"@/components/primitives/scroll-area\";\nimport { useConversationVisibility } from \"./use-conversation-visibility\";\n\nexport type ConversationRootProps = HTMLChakraProps<\"div\", React.ComponentProps<typeof StickToBottomEl>>;\n\nexport const conversationRootDefaultProps = {\n \"aria-roledescription\": \"conversation\",\n initial: \"instant\",\n resize: \"instant\",\n role: \"log\",\n} as const;\n\nexport const ConversationRoot = chakra(\n StickToBottomEl,\n {\n base: {\n position: \"relative\",\n flex: 1,\n overflow: \"hidden\",\n height: \"full\",\n },\n },\n {\n forwardProps: [\"initial\", \"resize\"],\n defaultProps: conversationRootDefaultProps,\n },\n);\n\nexport type ConversationContentProps = Omit<React.ComponentProps<typeof ScrollArea>, \"contentProps\" | \"viewportRef\">;\n\nexport const ConversationContent = (props: ConversationContentProps) => {\n const { children, ...rest } = props;\n const { contentRef, scrollRef } = useStickToBottomContext();\n useConversationVisibility();\n\n return (\n <ScrollArea\n {...rest}\n height=\"full\"\n width=\"full\"\n showHorizontalScrollbar={false}\n viewportRef={scrollRef as React.Ref<HTMLDivElement>}\n contentRef={contentRef as React.Ref<HTMLDivElement>}\n verticalScrollbarProps={{ zIndex: 2 }}\n contentProps={{\n layerStyle: \"chatContent\",\n py: \"sm\",\n \"aria-live\": \"polite\",\n role: \"list\",\n }}\n >\n {children}\n </ScrollArea>\n );\n};\n\nexport type ConversationScrollButtonProps = IconButtonProps;\n\nexport const conversationScrollButtonContainerDefaultProps = {\n axis: \"horizontal\",\n bottom: \"md\",\n zIndex: 2,\n} as const;\n\nexport const ConversationScrollButton = (props: ConversationScrollButtonProps) => {\n const { isAtBottom, scrollToBottom } = useStickToBottomContext();\n\n return (\n !isAtBottom && (\n <AbsoluteCenter {...conversationScrollButtonContainerDefaultProps}>\n <IconButton rounded=\"full\" onClick={() => scrollToBottom()} variant=\"outline\" size=\"xs\" {...props}>\n <ArrowDownIcon size={16} />\n </IconButton>\n </AbsoluteCenter>\n )\n );\n};\n\nexport const ChatPrimitives = {\n Root: ConversationRoot,\n Viewport: ConversationContent,\n ScrollToBottom: ConversationScrollButton,\n} as const;\n","import type { HTMLChakraProps, RecipeVariantProps } from \"@chakra-ui/react\";\nimport { createSlotRecipeContext, defineSlotRecipe } from \"@chakra-ui/react\";\n\nconst recipe = defineSlotRecipe({\n className: \"ai-message\",\n slots: [\"root\", \"content\"],\n base: {\n root: {\n display: \"flex\",\n width: \"full\",\n alignItems: \"end\",\n justifyContent: \"end\",\n gap: \"sm\",\n \"&:has(+ [data-scope='ai-message'][data-part='root'])\": {\n mb: 0,\n },\n },\n content: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"sm\",\n textStyle: \"sm\",\n overflow: \"hidden\",\n borderRadius: \"0\",\n },\n },\n variants: {\n from: {\n user: {\n root: {\n mb: \"md\",\n flexDirection: \"row\",\n },\n content: {\n \"--chat-message-bg\": \"{colors.bg.subtle}\",\n bg: \"var(--chat-message-bg)\",\n px: \"xs\",\n py: \"xs\",\n width: \"full\",\n borderRadius: \"0\",\n },\n },\n assistant: {\n root: {\n mb: \"md\",\n flexDirection: \"row\",\n justifyContent: \"start\",\n },\n content: {\n width: \"full\",\n px: \"xs\",\n },\n },\n developer: {\n root: {\n width: \"full\",\n flexDirection: \"row-reverse\",\n },\n content: {\n width: \"full\",\n },\n },\n },\n size: {\n sm: {\n root: { gap: \"xs\" },\n content: { textStyle: \"xs\" },\n },\n md: {},\n lg: {\n root: { gap: \"md\" },\n content: { textStyle: \"md\" },\n },\n },\n // A message that could not be sent is dimmed until it is resent or removed.\n delivery: {\n sent: {},\n unsent: { content: { opacity: 0.6 } },\n },\n shape: {\n rounded: {\n content: { rounded: \"0\" },\n },\n pill: {\n content: { rounded: \"0\" },\n },\n square: {\n content: { rounded: \"0\" },\n },\n },\n },\n defaultVariants: {\n from: \"user\",\n size: \"md\",\n shape: \"rounded\",\n delivery: \"sent\",\n },\n});\n\nconst { withProvider, withContext } = createSlotRecipeContext({ recipe });\n\ntype VariantProps = RecipeVariantProps<typeof recipe>;\n\nexport interface MessageRootProps extends HTMLChakraProps<\"div\">, VariantProps {}\nexport const MessageRoot = withProvider<HTMLDivElement, MessageRootProps>(\"div\", \"root\");\n\nexport interface MessageContentProps extends HTMLChakraProps<\"div\">, VariantProps {}\nexport const MessageContent = withContext<HTMLDivElement, MessageContentProps>(\"div\", \"content\");\n\nexport const ChatMessage = {\n Root: MessageRoot,\n Content: MessageContent,\n} as const;\n","import { Box, Button, Code, Flex, HStack, Text } from \"@chakra-ui/react\";\nimport { ShieldCheck, ShieldX } from \"lucide-react\";\nimport { ScrollArea } from \"@/components/primitives/scroll-area\";\n\ninterface ApprovalPromptProps {\n toolName: string;\n toolInput?: unknown;\n onApprove: () => void;\n onDeny: () => void;\n}\n\nconst formatToolInput = (input: unknown) => {\n if (input == null) return null;\n\n const text = typeof input === \"string\" ? input : JSON.stringify(input, null, 2);\n if (text.length === 0) return null;\n\n const truncated = text.length > 200 ? `${text.slice(0, 200)}...` : text;\n return truncated;\n};\n\nexport const ApprovalPrompt = (props: ApprovalPromptProps) => {\n const { toolName, toolInput, onApprove, onDeny } = props;\n const formattedInput = formatToolInput(toolInput);\n\n return (\n <Box px=\"sm\" py=\"xs\" mx=\"sm\" borderWidth=\"1px\" borderColor=\"border.warning\" borderRadius=\"lg\" bg=\"bg.warning\">\n <Flex direction=\"column\" gap=\"xs\">\n <Text textStyle=\"label/S/medium\" color=\"fg\">\n Allow <Code size=\"sm\">{toolName}</Code>?\n </Text>\n\n {formattedInput ? (\n <ScrollArea maxH=\"6rem\">\n <Code size=\"sm\" whiteSpace=\"pre-wrap\" display=\"block\" width=\"100%\">\n {formattedInput}\n </Code>\n </ScrollArea>\n ) : null}\n\n <HStack gap=\"xs\" justifyContent=\"flex-end\">\n <Button size=\"xs\" variant=\"outline\" onClick={onDeny}>\n <ShieldX size={14} />\n Deny\n </Button>\n <Button size=\"xs\" colorPalette=\"green\" onClick={onApprove}>\n <ShieldCheck size={14} />\n Allow\n </Button>\n </HStack>\n </Flex>\n </Box>\n );\n};\n","import { Stack } from \"@chakra-ui/react\";\nimport type { ReactNode } from \"react\";\nimport { Fragment } from \"react\";\nimport type { ResourceBadgeProps } from \"@/components/primitives/resource-badge\";\nimport { ResourceBadge } from \"@/components/primitives/resource-badge\";\n\nexport type AttachmentListRenderBadge = (props: AttachmentListItemRenderProps) => ReactNode;\n\nexport interface AttachmentListItemRenderProps {\n attachmentId: string;\n onSelect?: () => void;\n onRemove?: () => void;\n size: ResourceBadgeProps[\"size\"];\n tone: ResourceBadgeProps[\"tone\"];\n}\n\nexport interface AttachmentListProps {\n attachments?: string[];\n onSelect?: (attachmentId: string) => void;\n onRemove?: (attachmentId: string) => void;\n renderBadge?: AttachmentListRenderBadge;\n size?: ResourceBadgeProps[\"size\"];\n tone?: ResourceBadgeProps[\"tone\"];\n}\n\nconst DEFAULT_SIZE: NonNullable<ResourceBadgeProps[\"size\"]> = \"md\";\nconst DEFAULT_TONE: NonNullable<ResourceBadgeProps[\"tone\"]> = \"neutral\";\n\n/**\n * Simple attachment list component that displays resource badges.\n *\n */\nexport const AttachmentList = (props: AttachmentListProps) => {\n const { attachments = [], onSelect, onRemove, renderBadge, size = DEFAULT_SIZE, tone = DEFAULT_TONE } = props;\n\n if (attachments.length === 0) return null;\n\n return (\n <Stack marginBottom=\"sm\" gap=\"1\" flexDir=\"row\" flexWrap=\"wrap\">\n {attachments.map((attachment) => {\n const select = onSelect ? () => onSelect(attachment) : undefined;\n const remove = onRemove ? () => onRemove(attachment) : undefined;\n\n if (renderBadge) {\n const rendered = renderBadge({ attachmentId: attachment, onSelect: select, onRemove: remove, size, tone });\n return <Fragment key={attachment}>{rendered}</Fragment>;\n }\n\n return (\n <ResourceBadge\n key={attachment}\n fileName={attachment}\n onSelect={select}\n onRemove={remove}\n size={size}\n tone={tone}\n />\n );\n })}\n </Stack>\n );\n};\n","import { useEffect, useRef } from \"react\";\nimport { useStickToBottomContext } from \"use-stick-to-bottom\";\n\nexport interface AutoScrollProps {\n userMessageCount: number;\n conversationKey?: string | null;\n}\n\ninterface ShouldAutoScrollArgs {\n previousUserMessageCount: number;\n userMessageCount: number;\n}\n\nexport interface AutoScrollState {\n conversationKey: string | null;\n userMessageCount: number;\n}\n\ninterface NextAutoScrollStateArgs {\n state: AutoScrollState;\n conversationKey?: string | null;\n userMessageCount: number;\n}\n\ninterface ScrollForNextAutoScrollStateArgs extends NextAutoScrollStateArgs {\n scrollToBottom: (animation?: \"instant\") => void;\n}\n\nexport const shouldAutoScroll = (args: ShouldAutoScrollArgs) => {\n const { previousUserMessageCount, userMessageCount } = args;\n\n if (previousUserMessageCount === 0) {\n return false;\n }\n\n return userMessageCount > previousUserMessageCount;\n};\n\nexport const getNextAutoScrollState = (args: NextAutoScrollStateArgs) => {\n const conversationKey = args.conversationKey ?? null;\n\n if (args.state.conversationKey !== conversationKey) {\n return {\n shouldScroll: false,\n state: {\n conversationKey,\n userMessageCount: args.userMessageCount,\n },\n };\n }\n\n return {\n shouldScroll: shouldAutoScroll({\n previousUserMessageCount: args.state.userMessageCount,\n userMessageCount: args.userMessageCount,\n }),\n state: {\n conversationKey,\n userMessageCount: Math.max(args.state.userMessageCount, args.userMessageCount),\n },\n };\n};\n\nexport const scrollForNextAutoScrollState = (args: ScrollForNextAutoScrollStateArgs) => {\n const next = getNextAutoScrollState(args);\n\n if (next.shouldScroll) {\n args.scrollToBottom(\"instant\");\n }\n\n return next;\n};\n\nexport function AutoScroll(props: AutoScrollProps) {\n const { conversationKey, userMessageCount } = props;\n const { scrollToBottom } = useStickToBottomContext();\n const stateRef = useRef<AutoScrollState>({\n conversationKey: conversationKey ?? null,\n userMessageCount,\n });\n\n useEffect(() => {\n const next = scrollForNextAutoScrollState({\n state: stateRef.current,\n conversationKey,\n userMessageCount,\n scrollToBottom,\n });\n\n stateRef.current = next.state;\n }, [conversationKey, userMessageCount, scrollToBottom]);\n\n return null;\n}\n","import { defineSlotRecipe } from \"@chakra-ui/react\";\n\nexport const chatComposerRecipe = defineSlotRecipe({\n className: \"ps-chat-composer\",\n slots: [\"input\", \"workspace\"],\n base: {\n input: {\n position: \"relative\",\n width: \"full\",\n padding: \"xs\",\n bg: \"bg\",\n borderRadius: \"xs\",\n _focusWithin: { outline: \"{borders.accent-light}\", outlineOffset: \"-1px\" },\n },\n workspace: { display: \"flex\", flexDirection: \"column\", gap: \"0\" },\n },\n variants: {\n attachedToTop: {\n true: { input: { borderTopRadius: \"0\" } },\n },\n workspace: {\n true: {\n workspace: {\n padding: \"2xs\",\n borderRadius: \"xs\",\n bg: \"bg.muted\",\n },\n },\n },\n },\n});\n","import { generateEditorStateFromString } from \"../../rich-text\";\n\nexport const createSerializedPromptState = (input = \"\") => {\n return JSON.stringify(generateEditorStateFromString(input));\n};\n","interface ChatInputActionState {\n canInterrupt: boolean;\n /** False while the runtime cannot accept a message, for example without a model. */\n canSubmit: boolean;\n hasQuestionPrompt: boolean;\n isDisabled: boolean;\n streaming: boolean;\n text: string;\n}\n\nexport type ChatInputAction = \"interrupt\" | \"none\" | \"submit\";\n\nconst hasMessageText = (text: string) => text.trim().length > 0;\n\nexport const resolveChatInputKeyboardAction = (state: ChatInputActionState): ChatInputAction => {\n const { canSubmit, isDisabled, text } = state;\n if (isDisabled || !canSubmit || !hasMessageText(text)) return \"none\";\n return \"submit\";\n};\n\nexport const resolveChatInputButtonAction = (state: ChatInputActionState): ChatInputAction => {\n const { canInterrupt, canSubmit, hasQuestionPrompt, isDisabled, streaming, text } = state;\n if (isDisabled) return \"none\";\n if (canSubmit && hasMessageText(text)) return \"submit\";\n if (streaming && !hasQuestionPrompt) return canInterrupt ? \"interrupt\" : \"none\";\n return \"none\";\n};\n","import type { ClipboardEvent, DragEvent } from \"react\";\n\nexport const DEFAULT_TEXT_ATTACHMENT_PASTE_LINE_THRESHOLD = 200;\n\nexport const shouldAttachPastedText = (text: string, lineThreshold = DEFAULT_TEXT_ATTACHMENT_PASTE_LINE_THRESHOLD) =>\n text.length > 0 && text.split(/\\r\\n|\\r|\\n/).length > lineThreshold;\n\nexport const createAttachmentEventHandlers = (input: {\n onAttachFiles?: (files: File[]) => void;\n onAttachText?: (text: string) => void;\n textAttachmentPasteLineThreshold: number;\n}) => {\n const { onAttachFiles, onAttachText, textAttachmentPasteLineThreshold } = input;\n\n const onPasteCapture = (event: ClipboardEvent<HTMLDivElement>) => {\n const files = Array.from(event.clipboardData.files ?? []);\n if (files.length > 0 && onAttachFiles) {\n event.preventDefault();\n onAttachFiles(files);\n return;\n }\n\n const pastedText = event.clipboardData.getData(\"text/plain\");\n if (onAttachText && shouldAttachPastedText(pastedText, textAttachmentPasteLineThreshold)) {\n event.preventDefault();\n onAttachText(pastedText);\n }\n };\n\n const onDropCapture = (event: DragEvent<HTMLDivElement>) => {\n const files = Array.from(event.dataTransfer.files ?? []);\n if (files.length === 0 || !onAttachFiles) return;\n\n event.preventDefault();\n onAttachFiles(files);\n };\n\n const onDragOver = (event: DragEvent<HTMLDivElement>) => {\n if (!onAttachFiles || !Array.from(event.dataTransfer.types).includes(\"Files\")) return;\n event.preventDefault();\n };\n\n return { onDragOver, onDropCapture, onPasteCapture };\n};\n","import { IconButton, type IconButtonProps, Kbd, Portal, Tooltip } from \"@chakra-ui/react\";\nimport { ArrowUp, Pause } from \"lucide-react\";\n\nexport interface SendButtonProps extends IconButtonProps {\n shortcut?: string;\n title?: string;\n canInterrupt: boolean;\n}\n\nexport const SendButton = (props: SendButtonProps) => {\n const { title, shortcut, canInterrupt, ...rest } = props;\n const ariaLabel = rest[\"aria-label\"] ?? title;\n\n const icon = canInterrupt ? (\n <Pause size={16} strokeWidth={2} fill=\"currentColor\" />\n ) : (\n <ArrowUp size={16} strokeWidth={2} />\n );\n\n const button = (\n <IconButton\n data-testid=\"send-message-button\"\n size=\"xs\"\n variant=\"primary\"\n aria-label={ariaLabel}\n title={title}\n {...rest}\n >\n {icon}\n </IconButton>\n );\n\n if (title) {\n const tooltipContent = shortcut ? (\n <>\n {title} <Kbd fontSize=\"xs\">{shortcut}</Kbd>\n </>\n ) : (\n title\n );\n\n return (\n <Tooltip.Root closeDelay={50} openDelay={100}>\n <Tooltip.Trigger asChild>{button}</Tooltip.Trigger>\n <Portal>\n <Tooltip.Positioner>\n <Tooltip.Content>{tooltipContent}</Tooltip.Content>\n </Tooltip.Positioner>\n </Portal>\n </Tooltip.Root>\n );\n }\n\n return button;\n};\n","import { Button, HStack } from \"@chakra-ui/react\";\nimport type { ReactNode } from \"react\";\nimport { ScrollArea } from \"@/components/primitives/scroll-area\";\nimport type { ChatInputAction } from \"./chat-input-actions\";\nimport { COMPOSER_CONTROL_HEIGHT } from \"./composer-constants\";\nimport { SendButton } from \"./send-button\";\n\ninterface ChatInputToolbarProps {\n actions?: ReactNode;\n submitActions?: ReactNode;\n questionPrompt: boolean;\n skipDisabled: boolean;\n skipTitle: string;\n onSkip: () => void;\n buttonAction: ChatInputAction;\n submitTitle?: string;\n submitLabel?: string;\n messageTitle: string;\n runAction: (action: ChatInputAction) => void;\n}\nexport const ChatInputToolbar = (props: ChatInputToolbarProps) => {\n const {\n actions,\n submitActions,\n questionPrompt,\n skipDisabled,\n skipTitle,\n onSkip,\n buttonAction,\n submitTitle,\n submitLabel,\n messageTitle,\n runAction,\n } = props;\n return (\n <HStack gap=\"1\" minH={COMPOSER_CONTROL_HEIGHT} align=\"center\">\n <ScrollArea flex=\"1\" minW=\"0\" showVerticalScrollbar={false} showHorizontalScrollbar>\n <HStack gap=\"1\" width=\"max-content\" minH={COMPOSER_CONTROL_HEIGHT}>\n {actions}\n </HStack>\n </ScrollArea>\n {submitActions}\n {questionPrompt ? (\n <Button size=\"xs\" variant=\"ghost\" disabled={skipDisabled} title={skipTitle} onClick={onSkip}>\n Skip\n </Button>\n ) : null}\n {submitLabel ? (\n <Button size=\"xs\" variant=\"primary\" disabled={buttonAction === \"none\"} onClick={() => runAction(buttonAction)}>\n {submitLabel}\n </Button>\n ) : (\n <SendButton\n canInterrupt={buttonAction === \"interrupt\"}\n title={buttonAction === \"interrupt\" ? \"Stop Response\" : (submitTitle ?? messageTitle)}\n shortcut={buttonAction === \"submit\" ? \"Enter\" : undefined}\n onClick={() => runAction(buttonAction)}\n disabled={buttonAction === \"none\"}\n />\n )}\n </HStack>\n );\n};\n","import type { ReactNode } from \"react\";\nimport type { ChatInputQuestionResponse } from \"./chat-input-question-prompt\";\n\n/** A native decision occupies the composer without submitting the saved draft. */\nexport interface ComposerDecision {\n id: string;\n controls?: ReactNode;\n model?: string;\n pending?: boolean;\n actions: { id: string; label: string; variant: \"primary\" | \"subtle\" | \"ghost\"; disabled?: boolean }[];\n onAction: (actionId: string) => void | Promise<void>;\n}\n\ninterface ComposerResponseInput {\n response?: ChatInputQuestionResponse;\n text: string;\n attachments: string[];\n onSubmit: (text: string, attachments: string[], response?: ChatInputQuestionResponse) => void | Promise<void>;\n onClearAttachments?: () => void;\n}\n\nexport const submitComposerResponse = async (input: ComposerResponseInput) => {\n await input.onSubmit(input.text, input.response ? [] : input.attachments, input.response);\n if (!input.response) input.onClearAttachments?.();\n};\n","/** The \"Other\" choice shared by the question form and the helpers that read its answers. */\nexport const OTHER_CHOICE_LABEL = \"Other\";\n\n/**\n * The value the choice group carries while \"Other\" is picked. It never leaves the form: the typed\n * text is the answer. Listed choices use positional values, so agent labels cannot collide with it.\n */\nexport const OTHER_CHOICE_VALUE = \"__pstdio_other__\";\n\n// Question ids come from agents and may match inherited object properties.\nexport const getOwnQuestionValue = <T>(values: Record<string, T>, key: string) =>\n Object.hasOwn(values, key) ? values[key] : undefined;\n\n/**\n * A question with options offers its free text as an \"Other\" choice. A question with no options is\n * free text from the start, so its field is always open and there is nothing to be other than.\n */\nexport const questionOffersOtherChoice = (question: { options: unknown[]; allowCustomAnswer?: boolean }) =>\n Boolean(question.allowCustomAnswer) && question.options.length > 0;\n","import { getOwnQuestionValue } from \"./question-choices\";\n\nexport interface ChatInputQuestionOption {\n label: string;\n description?: string;\n}\n\nexport interface ChatInputQuestion {\n id?: string;\n question: string;\n options: ChatInputQuestionOption[];\n multiple?: boolean;\n required?: boolean;\n allowCustomAnswer?: boolean;\n}\n\nexport interface ChatInputQuestionPrompt {\n questions: ChatInputQuestion[];\n callId?: string;\n /** Async requests open from their chat bubble and preselect their first offered options. */\n delivery?: \"async\";\n}\n\nexport interface ChatInputQuestionResponse {\n answers: string[][];\n callId?: string;\n}\n\nexport type ChatInputQuestionCustomAnswers = Record<string, string>;\n\nexport const getQuestionSelectionKey = (question: ChatInputQuestion, index: number) =>\n question.id ?? `question-${index}`;\n\n// \"Other\" is chosen exactly when the question holds a custom answer, empty or not. That keeps\n// the choice and its text in one place instead of a second map that can disagree with it.\nexport const isQuestionOtherSelected = (\n customAnswersByQuestion: ChatInputQuestionCustomAnswers,\n question: ChatInputQuestion,\n questionIndex: number,\n // Question ids come from the agent, so `in` would match inherited keys such as \"constructor\".\n) => Object.hasOwn(customAnswersByQuestion, getQuestionSelectionKey(question, questionIndex));\n\nexport const clearQuestionOtherAnswer = (\n customAnswersByQuestion: ChatInputQuestionCustomAnswers,\n question: ChatInputQuestion,\n questionIndex: number,\n) => {\n const { [getQuestionSelectionKey(question, questionIndex)]: _removed, ...rest } = customAnswersByQuestion;\n return rest;\n};\n\nexport const toggleQuestionOtherAnswer = (\n customAnswersByQuestion: ChatInputQuestionCustomAnswers,\n question: ChatInputQuestion,\n questionIndex: number,\n) => {\n if (isQuestionOtherSelected(customAnswersByQuestion, question, questionIndex)) {\n return clearQuestionOtherAnswer(customAnswersByQuestion, question, questionIndex);\n }\n return { ...customAnswersByQuestion, [getQuestionSelectionKey(question, questionIndex)]: \"\" };\n};\n\n/** Shown in the chat so the transcript records that the person chose not to answer. */\nexport const SKIPPED_QUESTION_TEXT = \"Skipped the question.\";\n\n// The call id names the live request the prompt came from, so a reply can never reach a newer\n// request that asks the same question.\nexport const toQuestionResponse = (\n questionPrompt: ChatInputQuestionPrompt,\n answers: string[][],\n): ChatInputQuestionResponse => (questionPrompt.callId ? { answers, callId: questionPrompt.callId } : { answers });\n\n/** A skipped question carries no entry at all, which no answered form ever produces. */\nexport const buildSkippedQuestionResponse = (questionPrompt: ChatInputQuestionPrompt) =>\n toQuestionResponse(questionPrompt, []);\n\n// Single-choice questions swap the answer; multiple-choice questions toggle one option.\nexport const toggleQuestionOptionSelection = (\n selectedOptionsByQuestion: Record<string, string[]>,\n question: ChatInputQuestion,\n questionIndex: number,\n optionLabel: string,\n) => {\n const key = getQuestionSelectionKey(question, questionIndex);\n const selected = getOwnQuestionValue(selectedOptionsByQuestion, key) ?? [];\n const alreadySelected = selected.includes(optionLabel);\n if (question.multiple) {\n return {\n ...selectedOptionsByQuestion,\n [key]: alreadySelected ? selected.filter((label) => label !== optionLabel) : [...selected, optionLabel],\n };\n }\n return { ...selectedOptionsByQuestion, [key]: alreadySelected ? [] : [optionLabel] };\n};\n\nexport const getQuestionPromptSignature = (questionPrompt: ChatInputQuestionPrompt | undefined) => {\n if (!questionPrompt) return \"\";\n\n return JSON.stringify({\n callId: questionPrompt.callId,\n delivery: questionPrompt.delivery,\n questions: questionPrompt.questions.map((question, index) => ({\n id: getQuestionSelectionKey(question, index),\n question: question.question,\n multiple: Boolean(question.multiple),\n required: Boolean(question.required),\n allowCustomAnswer: Boolean(question.allowCustomAnswer),\n options: question.options.map((option) => ({\n label: option.label,\n description: option.description ?? \"\",\n })),\n })),\n });\n};\n\n// A single-choice question answers with one value: the typed text replaces the listed option it\n// was chosen instead of. A multiple-choice question keeps the typed text beside its checked boxes.\nexport const answersForQuestion = (\n question: ChatInputQuestion,\n selectedLabels: string[],\n customAnswer: string | undefined,\n) => {\n const typed = customAnswer?.trim();\n if (!typed) return selectedLabels;\n return question.multiple ? [...selectedLabels, typed] : [typed];\n};\n\nexport const getAnswersForQuestion = (\n question: ChatInputQuestion,\n key: string,\n selectedOptionsByQuestion: Record<string, string[]>,\n customAnswersByQuestion: ChatInputQuestionCustomAnswers,\n) =>\n answersForQuestion(\n question,\n getOwnQuestionValue(selectedOptionsByQuestion, key) ?? [],\n getOwnQuestionValue(customAnswersByQuestion, key),\n );\n\nconst getQuestionAnswerLines = (\n questionPrompt: ChatInputQuestionPrompt,\n selectedOptionsByQuestion: Record<string, string[]>,\n customAnswersByQuestion: ChatInputQuestionCustomAnswers,\n) => {\n const lines: string[] = [];\n\n for (let index = 0; index < questionPrompt.questions.length; index += 1) {\n const question = questionPrompt.questions[index];\n const key = getQuestionSelectionKey(question, index);\n const answers = getAnswersForQuestion(question, key, selectedOptionsByQuestion, customAnswersByQuestion);\n if (answers.length === 0) continue;\n\n lines.push(`${question.question}: ${answers.join(\", \")}`);\n }\n\n return lines;\n};\n\nconst isCustomAnswersByQuestion = (\n value: ChatInputQuestionCustomAnswers | string,\n): value is ChatInputQuestionCustomAnswers => typeof value !== \"string\";\n\nconst toCustomAnswersByQuestion = (\n questionPrompt: ChatInputQuestionPrompt,\n answerInput: ChatInputQuestionCustomAnswers | string,\n) => {\n if (isCustomAnswersByQuestion(answerInput)) return answerInput;\n\n const trimmed = answerInput.trim();\n if (trimmed.length === 0) return {};\n\n return Object.fromEntries(\n questionPrompt.questions.flatMap((question, index) =>\n question.allowCustomAnswer ? [[getQuestionSelectionKey(question, index), trimmed]] : [],\n ),\n );\n};\n\nexport const buildQuestionResponse = (\n questionPrompt: ChatInputQuestionPrompt | undefined,\n selectedOptionsByQuestion: Record<string, string[]>,\n answerInput: ChatInputQuestionCustomAnswers | string,\n) => {\n if (!questionPrompt) return typeof answerInput === \"string\" ? answerInput.trim() : \"\";\n\n const customAnswersByQuestion = toCustomAnswersByQuestion(questionPrompt, answerInput);\n const lines = getQuestionAnswerLines(questionPrompt, selectedOptionsByQuestion, customAnswersByQuestion);\n const legacyText = typeof answerInput === \"string\" ? answerInput.trim() : \"\";\n const hasCustomQuestions = questionPrompt.questions.some((question) => question.allowCustomAnswer);\n\n if (legacyText.length > 0 && !hasCustomQuestions) {\n lines.push(`Additional response: ${legacyText}`);\n }\n\n return lines.join(\"\\n\");\n};\n\nexport const buildQuestionAnswerValues = (\n questionPrompt: ChatInputQuestionPrompt,\n selectedOptionsByQuestion: Record<string, string[]>,\n answerInput: ChatInputQuestionCustomAnswers | string,\n) => {\n const customAnswersByQuestion = toCustomAnswersByQuestion(questionPrompt, answerInput);\n\n return questionPrompt.questions.map((question, index) => {\n const key = getQuestionSelectionKey(question, index);\n return getAnswersForQuestion(question, key, selectedOptionsByQuestion, customAnswersByQuestion);\n });\n};\n\nexport const hasMissingRequiredQuestionAnswer = (\n questionPrompt: ChatInputQuestionPrompt | undefined,\n selectedOptionsByQuestion: Record<string, string[]>,\n answerInput: ChatInputQuestionCustomAnswers | string,\n) => {\n if (!questionPrompt) return false;\n\n const customAnswersByQuestion = toCustomAnswersByQuestion(questionPrompt, answerInput);\n\n for (let index = 0; index < questionPrompt.questions.length; index += 1) {\n const question = questionPrompt.questions[index];\n if (!question.required) continue;\n\n const key = getQuestionSelectionKey(question, index);\n // One rule decides what a question answers with, so the send guard cannot drift from it.\n if (getAnswersForQuestion(question, key, selectedOptionsByQuestion, customAnswersByQuestion).length > 0) continue;\n\n return true;\n }\n\n return false;\n};\n","import { Button } from \"@chakra-ui/react\";\nimport { Check } from \"lucide-react\";\nimport { Tooltip } from \"@/components/primitives/tooltip\";\nimport {\n type ChatInputQuestion,\n type ChatInputQuestionCustomAnswers,\n getAnswersForQuestion,\n getQuestionSelectionKey,\n} from \"./chat-input-question-answers\";\n\ninterface QuestionStepTabProps {\n question: ChatInputQuestion;\n questionIndex: number;\n isActive: boolean;\n selectedOptionsByQuestion: Record<string, string[]>;\n customAnswersByQuestion: ChatInputQuestionCustomAnswers;\n onSelectStep: (questionIndex: number) => void;\n}\n\nconst hasQuestionAnswer = (\n question: ChatInputQuestion,\n questionIndex: number,\n selectedOptionsByQuestion: Record<string, string[]>,\n customAnswersByQuestion: ChatInputQuestionCustomAnswers,\n) => {\n const key = getQuestionSelectionKey(question, questionIndex);\n // The same rule the send guard uses, so a ticked step always matches what the form would send.\n return getAnswersForQuestion(question, key, selectedOptionsByQuestion, customAnswersByQuestion).length > 0;\n};\n\nexport const QuestionStepTab = (props: QuestionStepTabProps) => {\n const { question, questionIndex, isActive, selectedOptionsByQuestion, customAnswersByQuestion, onSelectStep } = props;\n const isAnswered = hasQuestionAnswer(question, questionIndex, selectedOptionsByQuestion, customAnswersByQuestion);\n const stepStateLabel = isAnswered ? \"answered\" : \"not answered\";\n const tabVariant = isActive ? \"outline\" : \"ghost\";\n\n return (\n <Tooltip content={question.question}>\n <Button\n id={`question-step-tab-${question.id}`}\n role=\"tab\"\n aria-label={`${question.question} (${stepStateLabel})`}\n aria-selected={isActive}\n aria-controls={`question-step-panel-${question.id}`}\n size=\"xs\"\n variant={tabVariant}\n minW=\"8\"\n onClick={() => onSelectStep(questionIndex)}\n >\n {isAnswered ? <Check aria-hidden=\"true\" /> : questionIndex + 1}\n </Button>\n </Tooltip>\n );\n};\n","import type { SessionMessage, ToolPart } from \"../components/message-types\";\nimport type { QuestionFormBlockOption, QuestionFormBlockQuestion } from \"../components/timeline\";\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n};\n\nconst parseJsonObjectText = (value: string) => {\n try {\n const parsed: unknown = JSON.parse(value);\n return isRecord(parsed) ? parsed : null;\n } catch {\n return null;\n }\n};\n\nconst toInputRecord = (input: unknown) => {\n if (isRecord(input)) return input;\n if (typeof input === \"string\" && input.trim().length > 0) return parseJsonObjectText(input);\n return null;\n};\n\nconst getStringValue = (value: unknown) => {\n if (typeof value === \"string\" && value.trim().length > 0) return value;\n return null;\n};\n\nexport const getQuestionResponseText = (value: unknown): string | null => {\n const stringValue = getStringValue(value);\n if (stringValue) return stringValue;\n\n if (Array.isArray(value)) {\n const lines = value.map(getQuestionResponseText).filter((line): line is string => line !== null);\n return lines.length > 0 ? lines.join(\"\\n\") : null;\n }\n\n if (!isRecord(value)) return null;\n\n return (\n getQuestionResponseText(value.response) ??\n getQuestionResponseText(value.answer) ??\n getQuestionResponseText(value.text) ??\n getQuestionResponseText(value.answers)\n );\n};\n\nconst carriesAnswers = (value: unknown): boolean => {\n if (!isRecord(value)) return false;\n if (Array.isArray(value.answers)) return true;\n return carriesAnswers(value.response) || carriesAnswers(value.answer);\n};\n\n/**\n * Whether the person has responded at all. A skipped question answers with no values, so it has a\n * response payload but no response text; reading the text alone would leave the form open forever.\n */\nexport const hasQuestionResponse = (value: unknown) => getQuestionResponseText(value) !== null || carriesAnswers(value);\n\nconst parseQuestionOption = (value: unknown): QuestionFormBlockOption | null => {\n if (typeof value === \"string\" && value.trim().length > 0) {\n return { label: value, description: undefined };\n }\n\n if (!isRecord(value)) return null;\n const label = getStringValue(value.label);\n if (!label) return null;\n\n return {\n label,\n description: getStringValue(value.description) ?? undefined,\n };\n};\n\nconst parseQuestion = (value: unknown, index: number): QuestionFormBlockQuestion | null => {\n if (!isRecord(value)) return null;\n\n const question = getStringValue(value.question);\n if (!question) return null;\n\n const options = Array.isArray(value.options)\n ? value.options.map(parseQuestionOption).filter((option): option is QuestionFormBlockOption => option !== null)\n : [];\n const type = getStringValue(value.type);\n const declaredCustomAnswer =\n typeof value.allowCustomAnswer === \"boolean\"\n ? value.allowCustomAnswer\n : options.length === 0 || type === \"freeform\" || type === \"text\";\n const allowCustomAnswer = typeof value.custom === \"boolean\" ? value.custom : declaredCustomAnswer;\n\n return {\n id: getStringValue(value.id) ?? `question-${index}`,\n question,\n options,\n multiple:\n typeof value.multiple === \"boolean\" ? value.multiple : type === \"multi_choice\" || type === \"multiple_choice\",\n required: typeof value.required === \"boolean\" ? value.required : true,\n allowCustomAnswer,\n };\n};\n\nexport const parseQuestionPrompt = (input: unknown) => {\n const record = toInputRecord(input);\n if (!record || !Array.isArray(record.questions)) return null;\n\n const questions = record.questions.map(parseQuestion).filter((question): question is QuestionFormBlockQuestion => {\n return question !== null;\n });\n if (questions.length === 0) return null;\n\n return { questions, ...(record.delivery === \"async\" ? { delivery: \"async\" as const } : {}) };\n};\n\nconst isQuestionTool = (part: ToolPart) => part.tool.toLowerCase() === \"question\";\n\nconst orderedQuestionRequests = (messages: SessionMessage[]) => {\n // Map preserves arrival order while later snapshots replace native request state.\n const requests = new Map<string | ToolPart, ToolPart>();\n for (const message of messages) {\n if (message.role !== \"assistant\") continue;\n for (const part of message.parts) {\n if (part.type !== \"tool\" || !isQuestionTool(part)) continue;\n requests.set(part.callId ?? part, part);\n }\n }\n return requests.values();\n};\n\nexport const getQuestionRequestKey = (part: ToolPart) => part.callId ?? JSON.stringify(part.state?.input);\n\nexport const isPendingQuestion = (part: ToolPart) =>\n part.status !== \"failed\" &&\n part.status !== \"denied\" &&\n !hasQuestionResponse(part.state?.output) &&\n !hasQuestionResponse(part.state?.metadata);\n\nconst questionPromptFor = (part: ToolPart) => {\n if (!isPendingQuestion(part)) return undefined;\n const prompt = parseQuestionPrompt(part.state?.input);\n return prompt ? { ...prompt, ...(part.callId ? { callId: part.callId } : {}) } : undefined;\n};\n\nexport const resolveQuestionPrompt = (messages: SessionMessage[], key: string) => {\n const part = [...orderedQuestionRequests(messages)].find((part) => getQuestionRequestKey(part) === key);\n return part ? questionPromptFor(part) : undefined;\n};\n\nexport const resolveActiveQuestionPrompt = (messages: SessionMessage[]) => {\n for (const part of orderedQuestionRequests(messages)) {\n const prompt = questionPromptFor(part);\n if (prompt && prompt.delivery !== \"async\") return prompt;\n }\n return undefined;\n};\n\nexport const getQuestionBubbleAnswer = (part: ToolPart, index: number): string | undefined => {\n for (const value of [part.state?.metadata, part.state?.output]) {\n const record = toInputRecord(value);\n if (Array.isArray(record?.answers)) {\n const answers = record.answers[index];\n return Array.isArray(answers) && answers.length ? answers.join(\", \") : \"Skipped\";\n }\n }\n if (isPendingQuestion(part)) return undefined;\n const prompt = parseQuestionPrompt(part.state?.input);\n const text = getQuestionResponseText(part.state?.output);\n if (!text || !prompt) return part.status === \"failed\" || part.status === \"denied\" ? \"Unavailable\" : \"Answered\";\n const question = prompt.questions[index].question;\n const answer = text.split(/\\n\\n/).find((section) => section.startsWith(`${question}\\n`));\n if (answer) return answer.slice(question.length + 1).trim() || \"Skipped\";\n return prompt.questions.length === 1 ? text : \"Answered\";\n};\n","import { createContext, useContext, useState } from \"react\";\nimport { getQuestionRequestKey, resolveQuestionPrompt } from \"../tool-rendering/question-prompt\";\nimport type { SessionMessage, ToolPart } from \"./message-types\";\n\ninterface QuestionSelection {\n conversationKey?: string;\n key: string;\n index: number;\n revision: number;\n}\n\ninterface QuestionNavigation {\n activeKey?: string;\n selection?: QuestionSelection;\n open: (part: ToolPart, index: number) => void;\n selectStep: (index: number) => void;\n close: () => void;\n}\n\nexport const ChatQuestionNavigationContext = createContext<QuestionNavigation | undefined>(undefined);\nexport const useQuestionNavigation = () => useContext(ChatQuestionNavigationContext);\n\nexport const useChatQuestionNavigation = (messages: SessionMessage[], conversationKey?: string) => {\n const [selection, setSelection] = useState<QuestionSelection>();\n const current = selection?.conversationKey === conversationKey ? selection : undefined;\n const prompt = current ? resolveQuestionPrompt(messages, current.key) : undefined;\n return {\n prompt,\n value: {\n activeKey: prompt ? current?.key : undefined,\n selection: prompt ? current : undefined,\n open: (part: ToolPart, index: number) =>\n setSelection((previous) => ({\n conversationKey,\n key: getQuestionRequestKey(part),\n index,\n revision: (previous?.revision ?? 0) + 1,\n })),\n selectStep: (index) => setSelection((previous) => (previous ? { ...previous, index } : undefined)),\n close: () => setSelection(undefined),\n } satisfies QuestionNavigation,\n };\n};\n","import { Box, Stack, Text, Textarea } from \"@chakra-ui/react\";\nimport type { FormEvent, ReactNode } from \"react\";\nimport { Checkbox } from \"@/components/primitives/checkbox\";\nimport { Radio, RadioGroup } from \"@/components/primitives/radio\";\nimport {\n getOwnQuestionValue,\n OTHER_CHOICE_LABEL,\n OTHER_CHOICE_VALUE,\n questionOffersOtherChoice,\n} from \"./question-choices\";\nimport type { QuestionFormBlockQuestion, TodoListBlockItem } from \"./timeline\";\n\nconst preventSubmit = (event: FormEvent) => {\n event.preventDefault();\n};\n\ninterface QuestionFormBlockViewProps {\n questions: QuestionFormBlockQuestion[];\n editable?: boolean;\n selectedOptionsByQuestion?: Record<string, string[]>;\n customAnswersByQuestion?: Record<string, string>;\n onToggleOption?: (question: QuestionFormBlockQuestion, questionIndex: number, optionLabel: string) => void;\n onToggleOther?: (question: QuestionFormBlockQuestion, questionIndex: number) => void;\n onCustomAnswerChange?: (question: QuestionFormBlockQuestion, questionIndex: number, answer: string) => void;\n}\n\nconst QuestionOptionContent = (props: { option: QuestionFormBlockQuestion[\"options\"][number] }) => {\n const { option } = props;\n\n return (\n <Stack gap=\"0\" minWidth=\"0\">\n <Text textStyle=\"label/S/regular\" color=\"fg\">\n {option.label}\n </Text>\n {option.description ? (\n <Text textStyle=\"label/XS/regular\" color=\"fg.muted\">\n {option.description}\n </Text>\n ) : null}\n </Stack>\n );\n};\n\nconst QuestionCheckboxOptionRow = (props: {\n option: QuestionFormBlockQuestion[\"options\"][number];\n name: string;\n checked: boolean;\n editable: boolean;\n onToggle: () => void;\n}) => {\n const { option, name, checked, editable, onToggle } = props;\n\n return (\n <Checkbox\n name={name}\n checked={checked}\n readOnly={!editable}\n aria-readonly={editable ? undefined : \"true\"}\n inputProps={editable ? undefined : { tabIndex: -1 }}\n alignItems=\"flex-start\"\n onCheckedChange={editable ? onToggle : undefined}\n >\n <QuestionOptionContent option={option} />\n </Checkbox>\n );\n};\n\nconst QuestionRadioOptions = (props: {\n question: QuestionFormBlockQuestion;\n questionIndex: number;\n name: string;\n selectedOption?: string;\n otherSelected: boolean;\n editable: boolean;\n onToggleOption?: (question: QuestionFormBlockQuestion, questionIndex: number, optionLabel: string) => void;\n onToggleOther?: (question: QuestionFormBlockQuestion, questionIndex: number) => void;\n otherField?: ReactNode;\n}) => {\n const { question, questionIndex, name, selectedOption, otherSelected, editable, onToggleOption, onToggleOther } =\n props;\n const { otherField } = props;\n const hasOtherChoice = questionOffersOtherChoice(question);\n const selectedIndex = question.options.findIndex((option) => option.label === selectedOption);\n const selectedValue = selectedIndex === -1 ? null : String(selectedIndex);\n\n return (\n <RadioGroup\n name={name}\n value={otherSelected ? OTHER_CHOICE_VALUE : selectedValue}\n readOnly={!editable}\n aria-readonly={editable ? undefined : \"true\"}\n display=\"flex\"\n flexDirection=\"column\"\n gap=\"xs\"\n onValueChange={\n editable\n ? (details) => {\n if (!details.value) return;\n if (details.value === OTHER_CHOICE_VALUE) onToggleOther?.(question, questionIndex);\n else onToggleOption?.(question, questionIndex, question.options[Number(details.value)].label);\n }\n : undefined\n }\n >\n {question.options.map((option, optionIndex) => (\n <Radio\n key={option.label}\n value={String(optionIndex)}\n inputProps={editable ? undefined : { tabIndex: -1 }}\n alignItems=\"flex-start\"\n >\n <QuestionOptionContent option={option} />\n </Radio>\n ))}\n {hasOtherChoice ? (\n <Radio value={OTHER_CHOICE_VALUE} inputProps={editable ? undefined : { tabIndex: -1 }} alignItems=\"flex-start\">\n <QuestionOptionContent option={{ label: OTHER_CHOICE_LABEL }} />\n </Radio>\n ) : null}\n {otherSelected ? otherField : null}\n </RadioGroup>\n );\n};\n\nexport const TodoListBlockView = (props: { items: TodoListBlockItem[] }) => {\n const { items } = props;\n\n return (\n <Stack as=\"ul\" gap=\"0\" listStyleType=\"none\" margin=\"0\" padding=\"0\">\n {items.map((item, index) => (\n <Box as=\"li\" key={`${item.label}-${index}`}>\n <Checkbox checked={item.checked} readOnly aria-readonly=\"true\" inputProps={{ tabIndex: -1 }} size=\"xs\">\n <Text textStyle=\"label/XS/regular\" color=\"fg\">\n {item.label}\n </Text>\n </Checkbox>\n </Box>\n ))}\n </Stack>\n );\n};\n\ninterface QuestionFieldsetProps {\n question: QuestionFormBlockQuestion;\n questionIndex: number;\n editable: boolean;\n selectedOptions: string[];\n customAnswer: string | undefined;\n onToggleOption?: (question: QuestionFormBlockQuestion, questionIndex: number, optionLabel: string) => void;\n onToggleOther?: (question: QuestionFormBlockQuestion, questionIndex: number) => void;\n onCustomAnswerChange?: (question: QuestionFormBlockQuestion, questionIndex: number, answer: string) => void;\n}\n\nconst QuestionOtherField = (props: QuestionFieldsetProps & { hasOtherChoice: boolean }) => {\n const { question, questionIndex, editable, customAnswer, onCustomAnswerChange, hasOtherChoice } = props;\n const editablePlaceholder = hasOtherChoice ? \"Type your answer...\" : \"Answer...\";\n\n return (\n <Textarea\n readOnly={!editable}\n aria-readonly={editable ? undefined : \"true\"}\n value={customAnswer ?? \"\"}\n placeholder={editable ? editablePlaceholder : \"Answer\"}\n aria-label={hasOtherChoice ? `${question.question} (${OTHER_CHOICE_LABEL})` : question.question}\n rows={2}\n borderWidth=\"1px\"\n borderColor=\"border.subtle\"\n borderRadius=\"sm\"\n padding=\"xs\"\n resize={editable ? \"vertical\" : \"none\"}\n color=\"fg\"\n onChange={(event) => onCustomAnswerChange?.(question, questionIndex, event.currentTarget.value)}\n />\n );\n};\n\nconst QuestionCheckboxOptions = (props: QuestionFieldsetProps & { name: string; otherField: ReactNode }) => {\n const { question, questionIndex, editable, selectedOptions, customAnswer, onToggleOption, onToggleOther } = props;\n const { name, otherField } = props;\n const hasOtherChoice = questionOffersOtherChoice(question);\n const otherSelected = customAnswer !== undefined;\n\n return (\n <>\n {question.options.map((option) => (\n <QuestionCheckboxOptionRow\n key={option.label}\n option={option}\n name={name}\n checked={selectedOptions.includes(option.label)}\n editable={editable}\n onToggle={() => onToggleOption?.(question, questionIndex, option.label)}\n />\n ))}\n {hasOtherChoice ? (\n <QuestionCheckboxOptionRow\n option={{ label: OTHER_CHOICE_LABEL }}\n name={name}\n checked={otherSelected}\n editable={editable}\n onToggle={() => onToggleOther?.(question, questionIndex)}\n />\n ) : null}\n {otherSelected ? otherField : null}\n </>\n );\n};\n\nconst QuestionFieldset = (props: QuestionFieldsetProps) => {\n const { question, questionIndex, editable, selectedOptions, customAnswer, onToggleOption, onToggleOther } = props;\n const name = question.id ?? `question-${questionIndex}`;\n const hasOtherChoice = questionOffersOtherChoice(question);\n const otherField = question.allowCustomAnswer ? (\n <QuestionOtherField {...props} hasOtherChoice={hasOtherChoice} />\n ) : null;\n const hasChoices = question.options.length > 0 || hasOtherChoice;\n\n return (\n <Stack\n as=\"fieldset\"\n gap=\"xs\"\n borderWidth=\"1px\"\n borderColor=\"border.subtle\"\n borderRadius=\"sm\"\n padding=\"sm\"\n minWidth=\"0\"\n >\n <Text as=\"legend\" textStyle=\"label/S/medium\" color=\"fg\" paddingX=\"2xs\">\n {question.question}\n </Text>\n {hasChoices && question.multiple ? (\n <QuestionCheckboxOptions {...props} name={name} otherField={otherField} />\n ) : null}\n {hasChoices && !question.multiple ? (\n <QuestionRadioOptions\n question={question}\n questionIndex={questionIndex}\n name={name}\n selectedOption={selectedOptions[0]}\n otherSelected={customAnswer !== undefined}\n editable={editable}\n onToggleOption={onToggleOption}\n onToggleOther={onToggleOther}\n otherField={otherField}\n />\n ) : null}\n {/* Free text with nothing to choose between is not part of a choice group. */}\n {hasChoices ? null : otherField}\n </Stack>\n );\n};\n\nexport const QuestionFormBlockView = (props: QuestionFormBlockViewProps) => {\n const {\n questions,\n editable = false,\n selectedOptionsByQuestion = {},\n customAnswersByQuestion = {},\n onToggleOption,\n onToggleOther,\n onCustomAnswerChange,\n } = props;\n\n return (\n <Stack as=\"form\" gap=\"sm\" onSubmit={preventSubmit} aria-label=\"Question form\">\n {questions.map((question, questionIndex) => {\n const name = question.id ?? `question-${questionIndex}`;\n\n return (\n <QuestionFieldset\n key={name}\n question={question}\n questionIndex={questionIndex}\n editable={editable}\n selectedOptions={getOwnQuestionValue(selectedOptionsByQuestion, name) ?? []}\n customAnswer={getOwnQuestionValue(customAnswersByQuestion, name)}\n onToggleOption={onToggleOption}\n onToggleOther={onToggleOther}\n onCustomAnswerChange={onCustomAnswerChange}\n />\n );\n })}\n </Stack>\n );\n};\n","import { HStack, Stack } from \"@chakra-ui/react\";\nimport { useEffect, useRef, useState } from \"react\";\nimport {\n type ChatInputQuestion,\n type ChatInputQuestionCustomAnswers,\n type ChatInputQuestionPrompt,\n getQuestionPromptSignature,\n getQuestionSelectionKey,\n isQuestionOtherSelected,\n} from \"./chat-input-question-answers\";\nimport { QuestionStepTab } from \"./chat-input-question-step-tab\";\nimport { useQuestionNavigation } from \"./chat-question-navigation\";\nimport { getOwnQuestionValue } from \"./question-choices\";\nimport { QuestionFormBlockView } from \"./timeline-tool-blocks\";\n\nexport * from \"./chat-input-question-answers\";\n\nexport interface QuestionPromptControlsProps {\n isEditable: boolean;\n questionPrompt: ChatInputQuestionPrompt;\n selectedOptionsByQuestion: Record<string, string[]>;\n customAnswersByQuestion: ChatInputQuestionCustomAnswers;\n onToggleOption: (question: ChatInputQuestion, questionIndex: number, optionLabel: string) => void;\n onToggleOther: (question: ChatInputQuestion, questionIndex: number) => void;\n onCustomAnswerChange: (question: ChatInputQuestion, questionIndex: number, answer: string) => void;\n}\n\ninterface QuestionPromptStepperProps extends QuestionPromptControlsProps {\n questions: ReturnType<typeof toQuestionFormQuestions>;\n}\n\nconst toQuestionFormQuestions = (questionPrompt: ChatInputQuestionPrompt) =>\n questionPrompt.questions.map((question, index) => ({\n id: getQuestionSelectionKey(question, index),\n question: question.question,\n options: question.options,\n multiple: Boolean(question.multiple),\n required: Boolean(question.required),\n allowCustomAnswer: Boolean(question.allowCustomAnswer),\n }));\n\nconst QuestionPromptStepper = (props: QuestionPromptStepperProps) => {\n const { questionPrompt, selectedOptionsByQuestion, customAnswersByQuestion, onToggleOption, onCustomAnswerChange } =\n props;\n const { onToggleOther } = props;\n const { questions, isEditable } = props;\n const [activeQuestionIndex, setActiveQuestionIndex] = useState(0);\n const questionPanelRef = useRef<HTMLDivElement>(null);\n const navigation = useQuestionNavigation();\n const selection = navigation?.selection;\n const focusRevision = selection?.revision;\n useEffect(() => {\n if (focusRevision !== undefined) questionPanelRef.current?.focus();\n }, [focusRevision]);\n const selectStep = (index: number) => {\n if (selection) navigation?.selectStep(index);\n else setActiveQuestionIndex(index);\n };\n const renderQuestionIndex = Math.min(selection?.index ?? activeQuestionIndex, questions.length - 1);\n const activeQuestion = questions[renderQuestionIndex];\n const hasMultipleQuestions = questions.length > 1;\n\n return (\n <Stack gap=\"xs\" pb=\"sm\" pt={hasMultipleQuestions ? \"0\" : \"xs\"}>\n {hasMultipleQuestions ? (\n <HStack role=\"tablist\" aria-label=\"Question steps\" gap=\"1\" minWidth=\"0\">\n {questions.map((question, questionIndex) => (\n <QuestionStepTab\n key={question.id}\n question={question}\n questionIndex={questionIndex}\n isActive={questionIndex === renderQuestionIndex}\n selectedOptionsByQuestion={selectedOptionsByQuestion}\n customAnswersByQuestion={customAnswersByQuestion}\n onSelectStep={selectStep}\n />\n ))}\n </HStack>\n ) : null}\n <Stack\n ref={questionPanelRef}\n tabIndex={-1}\n id={`question-step-panel-${activeQuestion.id}`}\n role={hasMultipleQuestions ? \"tabpanel\" : undefined}\n aria-labelledby={hasMultipleQuestions ? `question-step-tab-${activeQuestion.id}` : undefined}\n gap=\"0\"\n >\n <QuestionFormBlockView\n questions={[activeQuestion]}\n editable={isEditable}\n selectedOptionsByQuestion={selectedOptionsByQuestion}\n customAnswersByQuestion={customAnswersByQuestion}\n onToggleOption={(_question, _questionIndex, optionLabel) => {\n const question = questionPrompt.questions[renderQuestionIndex];\n const selectedOptions = getOwnQuestionValue(selectedOptionsByQuestion, activeQuestion.id) ?? [];\n const hadSelection =\n selectedOptions.length > 0 ||\n isQuestionOtherSelected(customAnswersByQuestion, question, renderQuestionIndex);\n\n onToggleOption(question, renderQuestionIndex, optionLabel);\n // Advance after the first listed radio choice. Stay when editing an answer or choosing Other\n // so the person can finish their answer; checkboxes and the last step never advance automatically.\n if (!question.multiple && !hadSelection && renderQuestionIndex < questions.length - 1) {\n // Keep keyboard focus in the panel while the previous question's controls are removed.\n questionPanelRef.current?.focus();\n selectStep(renderQuestionIndex + 1);\n }\n }}\n onToggleOther={() => {\n onToggleOther(questionPrompt.questions[renderQuestionIndex], renderQuestionIndex);\n }}\n onCustomAnswerChange={(_question, _questionIndex, answer) => {\n onCustomAnswerChange(questionPrompt.questions[renderQuestionIndex], renderQuestionIndex, answer);\n }}\n />\n </Stack>\n </Stack>\n );\n};\n\nexport const QuestionPromptControls = (props: QuestionPromptControlsProps) => {\n const { questionPrompt } = props;\n const questions = toQuestionFormQuestions(questionPrompt);\n const questionPromptSignature = getQuestionPromptSignature(questionPrompt);\n\n return <QuestionPromptStepper key={questionPromptSignature} {...props} questions={questions} />;\n};\n","import { useEffect, useRef, useState } from \"react\";\nimport {\n buildQuestionAnswerValues,\n buildQuestionResponse,\n type ChatInputQuestion,\n type ChatInputQuestionCustomAnswers,\n type ChatInputQuestionPrompt,\n clearQuestionOtherAnswer,\n getQuestionPromptSignature,\n getQuestionSelectionKey,\n hasMissingRequiredQuestionAnswer,\n toggleQuestionOptionSelection,\n toggleQuestionOtherAnswer,\n} from \"./chat-input-question-prompt\";\n\nconst defaultSelections = (prompt: ChatInputQuestionPrompt | undefined) =>\n Object.fromEntries(\n (prompt?.questions ?? []).flatMap((question, index) =>\n prompt?.delivery === \"async\" && question.options.length\n ? [[getQuestionSelectionKey(question, index), [question.options[0].label]]]\n : [],\n ),\n );\n\n/**\n * Holds what the person picked for the open question and derives what the form would send.\n * `resetToken` clears the picks whenever the composer itself is reset, such as a new draft.\n */\nexport const useQuestionPromptState = (questionPrompt: ChatInputQuestionPrompt | undefined, resetToken?: unknown) => {\n const [selectedOptionsByQuestion, setSelectedOptionsByQuestion] = useState<Record<string, string[]>>(() =>\n defaultSelections(questionPrompt),\n );\n const [customAnswersByQuestion, setCustomAnswersByQuestion] = useState<ChatInputQuestionCustomAnswers>({});\n const signature = getQuestionPromptSignature(questionPrompt);\n const previousResetRef = useRef(JSON.stringify([signature, resetToken ?? null]));\n\n const reset = () => {\n setSelectedOptionsByQuestion(defaultSelections(questionPrompt));\n setCustomAnswersByQuestion({});\n };\n\n useEffect(() => {\n const current = JSON.stringify([signature, resetToken ?? null]);\n if (previousResetRef.current === current) return;\n previousResetRef.current = current;\n setSelectedOptionsByQuestion(defaultSelections(questionPrompt));\n setCustomAnswersByQuestion({});\n }, [signature, resetToken, questionPrompt]);\n\n const toggleOption = (question: ChatInputQuestion, questionIndex: number, optionLabel: string) => {\n setSelectedOptionsByQuestion((current) =>\n toggleQuestionOptionSelection(current, question, questionIndex, optionLabel),\n );\n // A listed choice replaces Other on a single-choice question.\n if (!question.multiple) {\n setCustomAnswersByQuestion((current) => clearQuestionOtherAnswer(current, question, questionIndex));\n }\n };\n\n const toggleOther = (question: ChatInputQuestion, questionIndex: number) => {\n setCustomAnswersByQuestion((current) => toggleQuestionOtherAnswer(current, question, questionIndex));\n // Other replaces the listed choice on a single-choice question.\n if (!question.multiple) {\n setSelectedOptionsByQuestion((current) => ({\n ...current,\n [getQuestionSelectionKey(question, questionIndex)]: [],\n }));\n }\n };\n\n const setCustomAnswer = (question: ChatInputQuestion, questionIndex: number, answer: string) => {\n const key = getQuestionSelectionKey(question, questionIndex);\n setCustomAnswersByQuestion((current) => ({ ...current, [key]: answer }));\n };\n\n return {\n signature,\n selectedOptionsByQuestion,\n customAnswersByQuestion,\n reset,\n restore: (selected: Record<string, string[]>, custom: ChatInputQuestionCustomAnswers) => {\n setSelectedOptionsByQuestion(selected);\n setCustomAnswersByQuestion(custom);\n },\n toggleOption,\n toggleOther,\n setCustomAnswer,\n responseText: questionPrompt\n ? buildQuestionResponse(questionPrompt, selectedOptionsByQuestion, customAnswersByQuestion)\n : \"\",\n hasMissingRequiredAnswer: hasMissingRequiredQuestionAnswer(\n questionPrompt,\n selectedOptionsByQuestion,\n customAnswersByQuestion,\n ),\n buildAnswers: () =>\n questionPrompt\n ? buildQuestionAnswerValues(questionPrompt, selectedOptionsByQuestion, customAnswersByQuestion)\n : [],\n };\n};\n","import { Button } from \"@chakra-ui/react\";\nimport type { ReactNode } from \"react\";\nimport { useRef, useState } from \"react\";\nimport type { ChatInputAction } from \"./chat-input-actions\";\nimport {\n buildSkippedQuestionResponse,\n type ChatInputQuestionPrompt,\n type ChatInputQuestionResponse,\n QuestionPromptControls,\n SKIPPED_QUESTION_TEXT,\n toQuestionResponse,\n} from \"./chat-input-question-prompt\";\nimport { ChatInputToolbar } from \"./chat-input-toolbar\";\nimport { useQuestionNavigation } from \"./chat-question-navigation\";\nimport { useQuestionPromptState } from \"./use-question-prompt-state\";\n\ninterface ChatInputQuestionFormProps {\n prompt: ChatInputQuestionPrompt;\n actions?: ReactNode;\n disabled: boolean;\n onSubmit: (text: string, response: ChatInputQuestionResponse) => Promise<void>;\n}\n\n/** Key this form by request identity so async requests never share answer state. */\nexport const ChatInputQuestionForm = (props: ChatInputQuestionFormProps) => {\n const { prompt, actions, disabled, onSubmit } = props;\n const question = useQuestionPromptState(prompt);\n const navigation = useQuestionNavigation();\n const [submitting, setSubmitting] = useState(false);\n const inFlight = useRef(false);\n const submit = async (skip = false) => {\n if (inFlight.current || disabled || (!skip && question.hasMissingRequiredAnswer)) return;\n inFlight.current = true;\n setSubmitting(true);\n const sent = {\n selectedOptions: question.selectedOptionsByQuestion,\n customAnswers: question.customAnswersByQuestion,\n };\n const text = skip ? SKIPPED_QUESTION_TEXT : question.responseText;\n const response = skip ? buildSkippedQuestionResponse(prompt) : toQuestionResponse(prompt, question.buildAnswers());\n question.reset();\n try {\n await onSubmit(text, response);\n // Keep accepted replies locked until native history removes this request.\n } catch {\n question.restore(sent.selectedOptions, sent.customAnswers);\n inFlight.current = false;\n setSubmitting(false);\n }\n };\n return (\n <>\n <QuestionPromptControls\n isEditable={!disabled && !submitting}\n questionPrompt={prompt}\n selectedOptionsByQuestion={question.selectedOptionsByQuestion}\n customAnswersByQuestion={question.customAnswersByQuestion}\n onToggleOption={question.toggleOption}\n onToggleOther={question.toggleOther}\n onCustomAnswerChange={question.setCustomAnswer}\n />\n <ChatInputToolbar\n actions={\n <>\n {prompt.delivery === \"async\" && navigation ? (\n <Button size=\"xs\" variant=\"ghost\" disabled={submitting} onClick={navigation.close}>\n Back to message\n </Button>\n ) : null}\n {actions}\n </>\n }\n questionPrompt\n skipDisabled={disabled || submitting}\n skipTitle=\"Skip this question and let the agent continue\"\n onSkip={() => void submit(true)}\n buttonAction={\n disabled || submitting || question.hasMissingRequiredAnswer || !question.responseText ? \"none\" : \"submit\"\n }\n messageTitle=\"Send answer\"\n runAction={(action: ChatInputAction) => {\n if (action === \"submit\") void submit();\n }}\n />\n </>\n );\n};\n","import { Button, Flex, HStack, Text } from \"@chakra-ui/react\";\nimport { useRef, useState } from \"react\";\nimport { COMPOSER_CONTROL_HEIGHT } from \"./composer-constants\";\nimport type { ComposerDecision } from \"./composer-decision\";\n\ninterface ComposerDecisionToolbarProps {\n decision: ComposerDecision;\n disabled: boolean;\n}\n\nexport const ComposerDecisionToolbar = (props: ComposerDecisionToolbarProps) => {\n const { decision, disabled } = props;\n const [submitting, setSubmitting] = useState(false);\n const inFlight = useRef(false);\n const choose = async (actionId: string) => {\n const action = decision.actions.find((item) => item.id === actionId);\n if (inFlight.current || disabled || decision.pending || !action || action.disabled) return;\n inFlight.current = true;\n setSubmitting(true);\n try {\n await decision.onAction(actionId);\n } catch {\n // The host reports the error and retains this native decision for retry.\n } finally {\n inFlight.current = false;\n setSubmitting(false);\n }\n };\n return (\n <Flex aria-label=\"Plan decision\" align=\"center\" justify=\"space-between\" gap=\"xs\" wrap=\"wrap\">\n {decision.controls}\n {decision.model ? (\n <Text textStyle=\"label/S/regular\" minH={COMPOSER_CONTROL_HEIGHT} display=\"flex\" alignItems=\"center\">\n {decision.model}\n </Text>\n ) : null}\n <HStack gap=\"xs\" marginStart=\"auto\" wrap=\"wrap\" justify=\"end\">\n {decision.actions.map((action) => (\n <Button\n key={action.id}\n size=\"xs\"\n variant={action.variant}\n disabled={disabled || submitting || decision.pending || action.disabled}\n onClick={() => void choose(action.id)}\n >\n {action.label}\n </Button>\n ))}\n </HStack>\n </Flex>\n );\n};\n","import type { ReactNode } from \"react\";\nimport { ChatInputQuestionForm } from \"./chat-input-question-form\";\nimport {\n type ChatInputQuestionPrompt,\n type ChatInputQuestionResponse,\n getQuestionPromptSignature,\n} from \"./chat-input-question-prompt\";\nimport type { ComposerDecision } from \"./composer-decision\";\nimport { ComposerDecisionToolbar } from \"./composer-decision-toolbar\";\nimport type { ComposerRequest } from \"./composer-request\";\n\ninterface ComposerTakeoverProps {\n request?: ComposerRequest;\n question?: ChatInputQuestionPrompt;\n decision?: ComposerDecision;\n actions?: ReactNode;\n disabled: boolean;\n submitDisabled: boolean;\n onSubmit: (answer: string, response: ChatInputQuestionResponse) => Promise<void>;\n}\nexport const ComposerTakeover = (props: ComposerTakeoverProps) => {\n const { request, question, decision, actions, disabled, submitDisabled, onSubmit } = props;\n if (request?.kind === \"decision\" && decision)\n return <ComposerDecisionToolbar key={decision.id} decision={decision} disabled={disabled} />;\n if (request?.kind === \"question\" && question)\n return (\n <ChatInputQuestionForm\n key={getQuestionPromptSignature(question)}\n prompt={question}\n actions={actions}\n disabled={disabled || submitDisabled}\n onSubmit={onSubmit}\n />\n );\n return null;\n};\n","import { useState } from \"react\";\n\n/**\n * Track one pending focus request for the composer. The prompt editor fulfils it once it is editable,\n * so a request made while the composer is locked waits instead of being lost.\n */\nexport const useComposerFocus = (autoFocus: boolean, focusSignal: number) => {\n const [requested, setRequested] = useState(autoFocus || focusSignal !== 0);\n const [source, setSource] = useState({ autoFocus, focusSignal });\n\n if (source.autoFocus !== autoFocus || source.focusSignal !== focusSignal) {\n setSource({ autoFocus, focusSignal });\n if ((autoFocus && !source.autoFocus) || (focusSignal !== 0 && focusSignal !== source.focusSignal)) {\n setRequested(true);\n }\n }\n\n return {\n requested,\n request: () => setRequested(true),\n complete: () => setRequested(false),\n };\n};\n","import type { SessionMessage } from \"./message-types\";\n\nexport const MAX_RECENT_USER_PROMPTS = 10;\n\nexport const getRecentUserPrompts = (messages: SessionMessage[]) => {\n const prompts: string[] = [];\n for (let i = messages.length - 1; i >= 0 && prompts.length < MAX_RECENT_USER_PROMPTS; i--) {\n const message = messages[i];\n if (message.role !== \"user\") continue;\n const text = message.parts.flatMap((part) => (part.type === \"text\" ? [part.text] : [])).join(\"\");\n if (text.trim()) prompts.push(text);\n }\n return prompts;\n};\n\nexport const movePromptHistory = (\n index: number | null,\n direction: \"previous\" | \"next\",\n text: string,\n count: number,\n) => {\n if (count === 0) return null;\n if (index === null) {\n return direction === \"previous\" && text === \"\" ? { index: 0 } : null;\n }\n if (direction === \"previous\") return { index: Math.min(index + 1, count - 1) };\n return { index: index === 0 ? null : index - 1 };\n};\n","import { useEffect, useRef } from \"react\";\nimport type { PromptEditorRef } from \"../../rich-text\";\nimport { MAX_RECENT_USER_PROMPTS, movePromptHistory } from \"./chat-input-history\";\n\ninterface ChatInputHistoryOptions {\n recentUserMessages: string[];\n text: string;\n blocked: boolean;\n resetKey: string;\n onChange: (text: string) => void;\n}\n\nexport const useChatInputHistory = (options: ChatInputHistoryOptions) => {\n const { recentUserMessages, text, blocked, resetKey, onChange } = options;\n const editorRef = useRef<PromptEditorRef>(null);\n const historyIndex = useRef<number | null>(null);\n const prompts = recentUserMessages.slice(0, MAX_RECENT_USER_PROMPTS);\n const signature = JSON.stringify(prompts);\n const resetSignature = JSON.stringify([signature, resetKey, blocked]);\n const previousResetSignature = useRef(resetSignature);\n useEffect(() => {\n if (previousResetSignature.current === resetSignature) return;\n previousResetSignature.current = resetSignature;\n historyIndex.current = null;\n }, [resetSignature]);\n\n const reset = () => {\n historyIndex.current = null;\n };\n const change = (value: string) => {\n if (historyIndex.current !== null && value !== prompts[historyIndex.current]) reset();\n onChange(value);\n };\n const recall = (direction: \"previous\" | \"next\") => {\n if (blocked) return false;\n const movement = movePromptHistory(historyIndex.current, direction, text, prompts.length);\n if (!movement) return false;\n historyIndex.current = movement.index;\n const value = movement.index === null ? \"\" : prompts[movement.index];\n editorRef.current?.setEditorValue(value);\n onChange(value);\n return true;\n };\n return { editorRef, reset, change, recallPrevious: () => recall(\"previous\"), recallNext: () => recall(\"next\") };\n};\n","import { useState } from \"react\";\nimport { getTextFromSerializedEditorState } from \"../../rich-text\";\n\n// The editor's content and its plain text. A seed is not a user edit, so adopting the host's\n// `defaultState` never reports a change. Text the editor already shows (the host echoing the\n// user's own typing) keeps the mounted editor, its selection and its history.\nexport const useChatInputText = (defaultState: string) => {\n const [adoptedState, setAdoptedState] = useState(defaultState);\n const [editorState, setEditorState] = useState(defaultState);\n const [editorKey, setEditorKey] = useState(0);\n const [text, setText] = useState(() => getTextFromSerializedEditorState(defaultState));\n\n const remountEditor = (state: string) => {\n setEditorState(state);\n setEditorKey((key) => key + 1);\n };\n\n if (adoptedState !== defaultState) {\n setAdoptedState(defaultState);\n // Compare serialized text on both sides: the plain editor text has no paragraph newlines.\n const nextText = getTextFromSerializedEditorState(defaultState);\n if (nextText !== getTextFromSerializedEditorState(editorState)) {\n remountEditor(defaultState);\n setText(nextText);\n }\n }\n\n return { editorKey, editorState, remountEditor, setEditorState, setText, text };\n};\n","import { type ChatInputQuestionPrompt, getQuestionPromptSignature } from \"./chat-input-question-prompt\";\nimport type { ComposerDecision } from \"./composer-decision\";\n\nexport interface ComposerRequest {\n kind: \"question\" | \"decision\";\n id: string;\n}\n\nexport const resolveComposerRequest = (\n question: ChatInputQuestionPrompt | undefined,\n decision: Pick<ComposerDecision, \"id\"> | undefined,\n active: ComposerRequest | undefined,\n) => {\n const waiting: ComposerRequest[] = [];\n if (question) waiting.push({ kind: \"question\", id: question.callId ?? getQuestionPromptSignature(question) });\n if (decision) waiting.push({ kind: \"decision\", id: decision.id });\n return waiting.find((request) => request.kind === active?.kind && request.id === active.id) ?? waiting[0];\n};\n","import { useState } from \"react\";\nimport type { ChatInputQuestionPrompt } from \"./chat-input-question-prompt\";\nimport type { ComposerDecision } from \"./composer-decision\";\nimport { type ComposerRequest, resolveComposerRequest } from \"./composer-request\";\n\nexport const useComposerRequest = (\n question: ChatInputQuestionPrompt | undefined,\n decision: ComposerDecision | undefined,\n) => {\n const [active, setActive] = useState<ComposerRequest>();\n const request = resolveComposerRequest(question, decision, active);\n if (request?.kind !== active?.kind || request?.id !== active?.id) setActive(request);\n return request;\n};\n","import { Box, Flex, Text, useSlotRecipe } from \"@chakra-ui/react\";\nimport { type MouseEvent, type ReactNode, useState } from \"react\";\nimport { ScrollArea } from \"@/components/primitives/scroll-area\";\nimport { chatComposerRecipe } from \"@/theme/recipes/chat-composer\";\nimport { type PromptCommand, PromptEditor } from \"../../rich-text\";\nimport type { PromptSelectionSnapshot } from \"../../rich-text/prompt-input/plugins/preserve-selection-plugin\";\nimport { createSerializedPromptState } from \"../utils/editor-state\";\nimport {\n type ChatInputAction,\n resolveChatInputButtonAction,\n resolveChatInputKeyboardAction,\n} from \"./chat-input-actions\";\nimport { createAttachmentEventHandlers, DEFAULT_TEXT_ATTACHMENT_PASTE_LINE_THRESHOLD } from \"./chat-input-attachments\";\nimport type { ChatInputQuestionPrompt, ChatInputQuestionResponse } from \"./chat-input-question-prompt\";\nimport { ChatInputToolbar } from \"./chat-input-toolbar\";\nimport { COMPOSER_CONTROL_HEIGHT } from \"./composer-constants\";\nimport { type ComposerDecision, submitComposerResponse } from \"./composer-decision\";\nimport { ComposerTakeover } from \"./composer-takeover\";\nimport { useComposerFocus } from \"./use-chat-input-focus\";\nimport { useChatInputHistory } from \"./use-chat-input-history\";\nimport { useChatInputText } from \"./use-chat-input-text\";\nimport { useComposerRequest } from \"./use-composer-request\";\n\nexport interface ChatInputProps {\n /**\n * Serialized editor state for the text to show. The editor adopts it whenever its text differs\n * from what the editor shows, so a host can pass its live draft. It is never echoed to `onChange`.\n */\n defaultState: string;\n /** Plain-text prompts from the active conversation, newest first. */\n recentUserMessages?: string[];\n placeholder?: string;\n onSubmit?: (\n text: string,\n attachments: string[],\n questionResponse?: ChatInputQuestionResponse,\n ) => void | Promise<void>;\n onInterrupt?: () => void;\n onAttachFiles?: (files: File[]) => void;\n onAttachText?: (text: string) => void;\n textAttachmentPasteLineThreshold?: number;\n streaming?: boolean;\n attachedResources?: string[];\n onClearAttachments?: () => void;\n isDisabled?: boolean;\n /** Keeps the editor usable but blocks sending, for example while no model is selected. */\n submitDisabled?: boolean;\n onChange?: (text: string) => void;\n attachmentList?: ReactNode;\n actions?: ReactNode;\n /** Secondary actions immediately before the submit button. */\n submitActions?: ReactNode;\n /** Attachment controls shown only while editing a message draft. */\n attachmentActions?: ReactNode;\n attachedToTop?: boolean;\n questionPrompt?: ChatInputQuestionPrompt;\n decision?: ComposerDecision;\n autoFocus?: boolean;\n focusSignal?: number;\n submitTitle?: string;\n submitLabel?: string;\n initialSelection?: PromptSelectionSnapshot;\n onSelectionChange?: (selection: PromptSelectionSnapshot) => void;\n onEditorStateChange?: (text: string, state: string) => void;\n retainTextUntilAcknowledged?: boolean;\n commands?: PromptCommand[];\n}\n\nconst ChatInputPlaceholder = (props: { placeholder?: string }) => {\n const { placeholder } = props;\n if (!placeholder) return null;\n\n return (\n <Text textStyle=\"label/M/regular\" color=\"fg.subtle\" pointerEvents=\"none\" position=\"absolute\" top=\"0\">\n {placeholder}\n </Text>\n );\n};\n\nexport const ChatInput = (props: ChatInputProps) => {\n const {\n defaultState,\n recentUserMessages = [],\n onSubmit = () => {},\n onInterrupt,\n onAttachFiles,\n onAttachText,\n textAttachmentPasteLineThreshold = DEFAULT_TEXT_ATTACHMENT_PASTE_LINE_THRESHOLD,\n streaming = false,\n attachedResources = [],\n onClearAttachments,\n isDisabled = false,\n submitDisabled = false,\n onChange,\n placeholder,\n attachmentList,\n actions,\n submitActions,\n attachmentActions,\n attachedToTop = false,\n questionPrompt,\n decision,\n autoFocus = false,\n focusSignal = 0,\n submitTitle,\n submitLabel,\n initialSelection,\n onSelectionChange,\n onEditorStateChange,\n retainTextUntilAcknowledged = false,\n commands = [],\n } = props;\n\n const request = useComposerRequest(questionPrompt, decision);\n const occupied = Boolean(request);\n\n const styles = useSlotRecipe({ recipe: chatComposerRecipe })({ attachedToTop });\n const [submitting, setSubmitting] = useState(false);\n const { editorKey, editorState, remountEditor, setEditorState, setText, text } = useChatInputText(defaultState);\n const focus = useComposerFocus(autoFocus, focusSignal);\n\n const history = useChatInputHistory({\n recentUserMessages,\n text,\n blocked: isDisabled || submitting || occupied,\n resetKey: String(editorKey),\n onChange: (value) => {\n setText(value);\n onChange?.(value);\n },\n });\n\n const handleContainerClick = (event: MouseEvent<HTMLDivElement>) => {\n const target = event.target;\n // Portaled controls bubble through React, but own their focus outside this box.\n if (!(target instanceof Element) || !event.currentTarget.contains(target)) return;\n if (target.closest(\"button, input, textarea, select, a, label, [role=button], [role=combobox]\")) return;\n if (occupied) return;\n focus.request();\n };\n\n const replaceDraftText = (value: string) => {\n remountEditor(createSerializedPromptState(value));\n history.change(value);\n };\n\n const canSubmit = !isDisabled && !submitting && !submitDisabled && !occupied;\n const actionState = {\n canInterrupt: !occupied && Boolean(onInterrupt),\n canSubmit: !submitDisabled && !occupied,\n hasQuestionPrompt: occupied,\n isDisabled: isDisabled || submitting,\n streaming,\n text,\n };\n const buttonAction = resolveChatInputButtonAction(actionState);\n const messageTitle = streaming ? \"Queue message\" : \"Send message\";\n const submitMessage = async () => {\n if (!canSubmit || !text.trim()) return;\n const sentText = text;\n history.reset();\n setSubmitting(true);\n // The conversation owns the message from the moment it is sent.\n if (!retainTextUntilAcknowledged) replaceDraftText(\"\");\n try {\n await submitComposerResponse({ text: text.trim(), attachments: attachedResources, onSubmit, onClearAttachments });\n } catch {\n // A rejected handoff leaves the draft available for a retry.\n if (!retainTextUntilAcknowledged) replaceDraftText(sentText);\n } finally {\n setSubmitting(false);\n focus.request();\n }\n };\n\n const runAction = (action: ChatInputAction) => {\n if (action === \"interrupt\") onInterrupt?.();\n if (action === \"submit\") void submitMessage();\n };\n\n const attachmentEventHandlers = createAttachmentEventHandlers({\n onAttachFiles,\n onAttachText,\n textAttachmentPasteLineThreshold,\n });\n\n return (\n <Box\n className=\"ps-chat-composer__input\"\n css={styles.input}\n onPasteCapture={occupied ? undefined : attachmentEventHandlers.onPasteCapture}\n onDropCapture={occupied ? undefined : attachmentEventHandlers.onDropCapture}\n onDragOver={occupied ? undefined : attachmentEventHandlers.onDragOver}\n onClick={handleContainerClick}\n >\n <Flex direction=\"column\" color=\"fg\" gap=\"xs\">\n <ComposerTakeover\n request={request}\n question={questionPrompt}\n decision={decision}\n actions={actions}\n disabled={isDisabled}\n submitDisabled={submitDisabled}\n onSubmit={(answer, response) =>\n submitComposerResponse({\n text: answer,\n response,\n attachments: attachedResources,\n onSubmit,\n onClearAttachments,\n })\n }\n />\n {/* Keep the editor mounted so a takeover preserves selection, composition and undo history. */}\n <Box display={occupied ? \"none\" : undefined}>\n {attachmentList ? <Box mb=\"xs\">{attachmentList}</Box> : null}\n <ScrollArea maxH=\"10rem\" showHorizontalScrollbar={false} contentProps={{ pr: \"2xs\" }}>\n <Flex minH={COMPOSER_CONTROL_HEIGHT} align=\"center\">\n <PromptEditor\n key={editorKey}\n ref={history.editorRef}\n onRecallPrevious={history.recallPrevious}\n onRecallNext={history.recallNext}\n defaultState={editorState}\n initialSelection={initialSelection}\n onSelectionChange={onSelectionChange}\n isEditable={!isDisabled && !submitting && !occupied}\n focusRequested={focus.requested}\n onFocusRequestComplete={focus.complete}\n placeholder={<ChatInputPlaceholder placeholder={placeholder} />}\n onChange={(nextText, state) => {\n setEditorState(JSON.stringify(state));\n onEditorStateChange?.(nextText, JSON.stringify(state));\n history.change(nextText);\n }}\n onSubmit={() => runAction(resolveChatInputKeyboardAction(actionState))}\n commands={commands}\n />\n </Flex>\n </ScrollArea>\n </Box>\n {!occupied ? (\n <ChatInputToolbar\n actions={\n <>\n {attachmentActions}\n {actions}\n </>\n }\n questionPrompt={false}\n skipDisabled={false}\n skipTitle=\"\"\n onSkip={() => {}}\n buttonAction={buttonAction}\n submitTitle={submitTitle}\n submitLabel={submitLabel}\n submitActions={submitActions}\n messageTitle={messageTitle}\n runAction={runAction}\n />\n ) : null}\n </Flex>\n </Box>\n );\n};\n","import { useRef } from \"react\";\n\nexport interface MessageAnimationState {\n initialized: boolean;\n seenKeys: Set<string>;\n}\n\ninterface NextMessageAnimationStateArgs {\n itemKeys: string[];\n state: MessageAnimationState;\n}\n\nexport const messageFadeInProps = {\n animationName: \"message-fade-in\",\n animationDuration: \"200ms\",\n animationTimingFunction: \"ease-out\",\n} as const;\n\nexport const getNextMessageAnimationState = (args: NextMessageAnimationStateArgs) => {\n const animatedKeys = new Set<string>();\n const seenKeys = new Set(args.state.seenKeys);\n\n for (const key of args.itemKeys) {\n if (args.state.initialized && !seenKeys.has(key)) {\n animatedKeys.add(key);\n }\n\n seenKeys.add(key);\n }\n\n return {\n animatedKeys,\n state: {\n initialized: true,\n seenKeys,\n },\n };\n};\n\nconst itemKeysEqual = (a: string[], b: string[]) => {\n if (a.length !== b.length) return false;\n for (let index = 0; index < a.length; index += 1) if (a[index] !== b[index]) return false;\n return true;\n};\n\nexport const useMessageAnimationKeys = (itemKeys: string[]) => {\n const stateRef = useRef<MessageAnimationState>({\n initialized: false,\n seenKeys: new Set(),\n });\n // The hook mutates state during render, so React's duplicate renders (Strict\n // Mode, concurrent reconciliation) would otherwise consume the animation\n // flag on the second pass and leave the message non-animating. Cache the\n // last inputs to make repeated calls idempotent.\n const lastResultRef = useRef<{ itemKeys: string[]; animatedKeys: Set<string> } | null>(null);\n\n if (lastResultRef.current && itemKeysEqual(lastResultRef.current.itemKeys, itemKeys)) {\n return lastResultRef.current.animatedKeys;\n }\n\n const next = getNextMessageAnimationState({\n itemKeys,\n state: stateRef.current,\n });\n\n stateRef.current = next.state;\n lastResultRef.current = { itemKeys: [...itemKeys], animatedKeys: next.animatedKeys };\n\n return next.animatedKeys;\n};\n","import { Box, HStack, IconButton, Text } from \"@chakra-ui/react\";\nimport { Check, Copy } from \"lucide-react\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { Tooltip } from \"@/components/primitives/tooltip\";\nimport type { ChatMessagePart, SessionMessage } from \"./message-types\";\n\ninterface MessageActionPanelProps {\n message: SessionMessage;\n alwaysVisible?: boolean;\n copyAlwaysVisible?: boolean;\n}\n\nconst isCopyablePart = (part: ChatMessagePart): part is Extract<ChatMessagePart, { type: \"text\" }> => {\n return part.type === \"text\";\n};\n\nexport const getMessageCopyText = (message: SessionMessage) => {\n return (message.parts ?? [])\n .filter(isCopyablePart)\n .map((part) => part.text.trim())\n .filter(Boolean)\n .join(\"\\n\\n\");\n};\n\nexport const getMessageTimestampLabel = (message: SessionMessage, locale?: string, timeZone?: string) => {\n if (message.delivery === \"unsent\") return \"Not sent\";\n if (!message.createdAt) return \"\";\n\n return new Intl.DateTimeFormat(locale, {\n hour: \"numeric\",\n minute: \"2-digit\",\n timeZone,\n }).format(new Date(message.createdAt));\n};\n\nexport const MessageActionPanel = (props: MessageActionPanelProps) => {\n const { message, alwaysVisible = false, copyAlwaysVisible = alwaysVisible } = props;\n const [isCopied, setIsCopied] = useState(false);\n const copyResetTimeoutRef = useRef<number | null>(null);\n const copyText = getMessageCopyText(message);\n const timestampLabel = getMessageTimestampLabel(message);\n\n useEffect(() => {\n return () => {\n if (copyResetTimeoutRef.current !== null) {\n window.clearTimeout(copyResetTimeoutRef.current);\n }\n };\n }, []);\n\n const copyMessage = async () => {\n if (!copyText) return;\n\n try {\n await navigator.clipboard.writeText(copyText);\n setIsCopied(true);\n if (copyResetTimeoutRef.current !== null) {\n window.clearTimeout(copyResetTimeoutRef.current);\n }\n copyResetTimeoutRef.current = window.setTimeout(() => setIsCopied(false), 1200);\n } catch {\n setIsCopied(false);\n }\n };\n\n if (!copyText && !timestampLabel) return null;\n\n return (\n <HStack\n data-chat-message-action-panel=\"true\"\n gap=\"2xs\"\n minH=\"6\"\n opacity={alwaysVisible ? \"1\" : \"0\"}\n pointerEvents={alwaysVisible ? \"auto\" : \"none\"}\n transition=\"opacity 120ms ease\"\n css={messageActionPanelHoverStyles}\n >\n {timestampLabel ? (\n <Text textStyle=\"label/XS/regular\" color=\"fg.muted\">\n {timestampLabel}\n </Text>\n ) : null}\n {copyText ? (\n <Box\n opacity={copyAlwaysVisible ? \"1\" : \"0\"}\n pointerEvents={copyAlwaysVisible ? \"auto\" : \"none\"}\n transition=\"opacity 120ms ease\"\n css={messageActionPanelHoverStyles}\n >\n <Tooltip content={isCopied ? \"Copied\" : \"Copy message\"}>\n <IconButton\n aria-label={isCopied ? \"Copied\" : \"Copy message\"}\n variant=\"ghost\"\n size=\"2xs\"\n onClick={copyMessage}\n >\n {isCopied ? <Check size={12} /> : <Copy size={12} />}\n </IconButton>\n </Tooltip>\n </Box>\n ) : null}\n </HStack>\n );\n};\n\nconst messageActionPanelHoverStyles = {\n \"[data-chat-message-with-actions]:hover &, [data-chat-message-with-actions]:focus-within &\": {\n opacity: 1,\n pointerEvents: \"auto\",\n },\n \".ai-message__root:hover &, .ai-message__root:focus-within &\": {\n opacity: 1,\n pointerEvents: \"auto\",\n },\n \"[data-scope='ai-message'][data-part='root']:hover &, [data-scope='ai-message'][data-part='root']:focus-within &\": {\n opacity: 1,\n pointerEvents: \"auto\",\n },\n};\n","import type { BoxProps } from \"@chakra-ui/react\";\nimport { Box } from \"@chakra-ui/react\";\nimport { RichMessage } from \"@/components/rich-text\";\nimport type { ChatLinkProps } from \"../links/chat-link\";\n\nexport interface ChatRichContentProps extends Omit<BoxProps, \"children\">, ChatLinkProps {\n children: string;\n streaming?: boolean;\n}\n\nconst ChatRichContent = (props: ChatRichContentProps) => {\n const { children, linkHandler, streaming, ...rest } = props;\n\n return (\n <Box {...rest}>\n <RichMessage defaultState={children} linkHandler={linkHandler} streaming={streaming} fullWidth />\n </Box>\n );\n};\n\nexport const Response = ChatRichContent;\n","import { chakra, Stack, useRecipe } from \"@chakra-ui/react\";\nimport { ArrowRight } from \"lucide-react\";\nimport { chatQuestionBubbleRecipe } from \"@/theme/recipes/chat-question-bubble\";\nimport {\n getQuestionBubbleAnswer,\n getQuestionRequestKey,\n isPendingQuestion,\n parseQuestionPrompt,\n} from \"../tool-rendering/question-prompt\";\nimport { useQuestionNavigation } from \"./chat-question-navigation\";\nimport type { ToolPart } from \"./message-types\";\n\ninterface ChatQuestionBubbleProps {\n part: ToolPart;\n}\n\nexport const ChatQuestionBubble = (props: ChatQuestionBubbleProps) => {\n const { part } = props;\n const prompt = parseQuestionPrompt(part.state?.input);\n const navigation = useQuestionNavigation();\n const recipe = useRecipe({ recipe: chatQuestionBubbleRecipe });\n if (!prompt) return null;\n const pending = isPendingQuestion(part);\n const canOpen = pending && Boolean(navigation);\n return (\n <Stack gap=\"xs\" align=\"start\">\n {prompt.questions.map((question, index) => {\n const answer = getQuestionBubbleAnswer(part, index) ?? question.options[0]?.label ?? \"Your answer\";\n const expanded =\n navigation?.activeKey === getQuestionRequestKey(part) && navigation?.selection?.index === index;\n return (\n <chakra.button\n key={question.id}\n type=\"button\"\n css={recipe({ multiline: question.question.includes(\"\\n\") })}\n data-state={pending ? \"pending\" : \"answered\"}\n disabled={!canOpen}\n aria-expanded={canOpen ? expanded : undefined}\n aria-label={`${question.question} → ${answer}${canOpen ? \". Open question\" : \"\"}`}\n onClick={() => navigation?.open(part, index)}\n >\n <span data-question-text>{question.question}</span>\n <span data-question-answer-row>\n <ArrowRight aria-hidden=\"true\" />\n <span data-question-answer>{answer}</span>\n </span>\n </chakra.button>\n );\n })}\n </Stack>\n );\n};\n","export const normalizeToolName = (value: string) => {\n return value\n .replace(/^tool-/i, \"\")\n .replace(/([a-z0-9])([A-Z])/g, \"$1_$2\")\n .replace(/[\\s-]+/g, \"_\")\n .toLowerCase();\n};\n\nexport const getToolNameLookupKeys = (value: string) => {\n const normalized = normalizeToolName(value);\n const compact = normalized.replace(/_/g, \"\");\n return [...new Set([value, normalized, compact])];\n};\n","import type { LucideIcon } from \"lucide-react\";\nimport {\n AlertTriangle,\n CircleQuestionMark,\n DotIcon,\n File,\n FileDiff,\n FileDown,\n FilePen,\n FileText,\n FileUp,\n Globe,\n ListTodo,\n ListTree,\n Move,\n Search,\n Terminal,\n Trash2,\n} from \"lucide-react\";\nimport { normalizeToolName } from \"./tool-name\";\n\nconst toolIconMap = {\n shell: Terminal,\n ls: ListTree,\n read_file: FileText,\n write_file: FilePen,\n delete_file: Trash2,\n patch: FileDiff,\n upload_files: FileUp,\n download_file: FileDown,\n move_file: Move,\n} as const satisfies Record<string, LucideIcon>;\n\nconst iconMap = {\n dot: DotIcon,\n danger: AlertTriangle,\n search: Search,\n browser: Globe,\n file: File,\n question: CircleQuestionMark,\n todo: ListTodo,\n terminal: Terminal,\n ...toolIconMap,\n} as const satisfies Record<string, LucideIcon>;\n\nexport type IconName = keyof typeof iconMap;\nexport type ToolIconName = keyof typeof toolIconMap;\n\nconst DEFAULT_TOOL_ICON: IconName = \"dot\";\n\nconst isToolIconName = (value: string): value is ToolIconName => Object.hasOwn(toolIconMap, value);\n\nexport const getIconComponent = (name: IconName): LucideIcon => {\n return iconMap[name];\n};\n\nexport const toolTypeToIconName = (type?: string): IconName => {\n if (!type) return DEFAULT_TOOL_ICON;\n\n const normalized = normalizeToolName(type);\n if (isToolIconName(normalized)) return normalized;\n\n const compact = normalized.replace(/_/g, \"\");\n\n switch (normalized) {\n case \"read\":\n return \"file\";\n case \"bash\":\n return \"terminal\";\n case \"edit\":\n return \"write_file\";\n case \"apply_patch\":\n return \"patch\";\n case \"grep\":\n return \"search\";\n case \"glob\":\n return \"file\";\n case \"todowrite\":\n return \"todo\";\n case \"search\":\n return \"search\";\n case \"browser\":\n return \"browser\";\n case \"question\":\n return \"question\";\n case \"fs\":\n case \"file\":\n return \"file\";\n default:\n return compact === \"todowrite\" || compact === \"todo\" ? \"todo\" : DEFAULT_TOOL_ICON;\n }\n};\n\nexport { getFileTypeIcon } from \"../../../utils/get-file-type-icon\";\n","import type { TitleSegment } from \"../components/timeline\";\n\nexport type FileChange = { filePath: string; additions: number; deletions: number };\n\nexport function basenameSafe(path: string) {\n const idx = path.lastIndexOf(\"/\");\n return idx >= 0 ? path.slice(idx + 1) : path;\n}\n\nfunction normalizeHeaderPath(input?: string | null) {\n if (!input) return null;\n\n const token = input.split(\"\\t\")[0].trim();\n if (token === \"/dev/null\") return null;\n\n let normalized = token;\n if (normalized.startsWith(\"a/\") || normalized.startsWith(\"b/\")) {\n normalized = normalized.slice(2);\n }\n\n return normalized.replace(/^\\/+/, \"\").replace(/\\\\/g, \"/\");\n}\n\nconst isMinusHeader = (line: string) => line.startsWith(\"--- \");\nconst isPlusHeader = (line: string) => line.startsWith(\"+++ \");\nconst isHunkHeader = (line: string) => line.startsWith(\"@@\");\nconst isAddedLine = (line: string) => line.startsWith(\"+\") && !(isPlusHeader(line) || line === \"+++\");\nconst isDeletedLine = (line: string) => line.startsWith(\"-\") && !(isMinusHeader(line) || line === \"---\");\n\nconst ensureFileChange = (changes: Map<string, { additions: number; deletions: number }>, filePath: string) => {\n if (!changes.has(filePath)) {\n changes.set(filePath, { additions: 0, deletions: 0 });\n }\n};\n\nconst incrementAdditions = (changes: Map<string, { additions: number; deletions: number }>, filePath: string) => {\n const current = changes.get(filePath);\n if (!current) return;\n current.additions += 1;\n};\n\nconst incrementDeletions = (changes: Map<string, { additions: number; deletions: number }>, filePath: string) => {\n const current = changes.get(filePath);\n if (!current) return;\n current.deletions += 1;\n};\n\ntype UnifiedDiffState = {\n currentPath: string | null;\n lastMinusHeader: string | null;\n inHunk: boolean;\n};\n\nconst processUnifiedDiffLine = (\n line: string,\n state: UnifiedDiffState,\n changes: Map<string, { additions: number; deletions: number }>,\n) => {\n if (isMinusHeader(line)) {\n return { ...state, lastMinusHeader: normalizeHeaderPath(line.slice(4)), inHunk: false };\n }\n\n if (isPlusHeader(line)) {\n const plusPath = normalizeHeaderPath(line.slice(4));\n const currentPath = plusPath ?? state.lastMinusHeader;\n if (currentPath) ensureFileChange(changes, currentPath);\n return { ...state, currentPath, inHunk: false };\n }\n\n if (!state.currentPath) return state;\n\n if (isHunkHeader(line)) {\n return { ...state, inHunk: true };\n }\n\n if (!state.inHunk) return state;\n\n if (isAddedLine(line)) {\n incrementAdditions(changes, state.currentPath);\n return state;\n }\n\n if (isDeletedLine(line)) {\n incrementDeletions(changes, state.currentPath);\n }\n\n return state;\n};\n\nexport function parseUnifiedDiff(diffText?: string) {\n if (!diffText || typeof diffText !== \"string\") return [] as FileChange[];\n\n const changes = new Map<string, { additions: number; deletions: number }>();\n let state: UnifiedDiffState = {\n currentPath: null,\n lastMinusHeader: null,\n inHunk: false,\n };\n\n const lines = diffText.split(/\\r?\\n/);\n for (const line of lines) {\n state = processUnifiedDiffLine(line, state, changes);\n }\n\n return Array.from(changes.entries()).map(([filePath, { additions, deletions }]) => ({\n filePath,\n additions,\n deletions,\n }));\n}\n\nexport function buildDiffTitleSegments(diffText?: string) {\n return parseUnifiedDiff(diffText).map(\n (file) =>\n ({\n kind: \"diff\",\n fileName: basenameSafe(file.filePath),\n filePath: file.filePath,\n additions: file.additions,\n deletions: file.deletions,\n }) satisfies TitleSegment,\n );\n}\n\nexport function extractDiffFilePaths(diffText?: string) {\n return parseUnifiedDiff(diffText).map((file) => file.filePath);\n}\n\nexport type FileDiffPreview = { filePath: string; original: string; modified: string };\n\nconst isDiffFileBoundary = (line: string) => isMinusHeader(line) || line.startsWith(\"diff --git \");\n\nconst isInvalidHunkBodyLine = (line: string) => {\n if (line.startsWith(\" \")) return false;\n if (line.startsWith(\"+\")) return false;\n if (line.startsWith(\"-\")) return false;\n return line.trim() !== \"\";\n};\n\nconst appendHunkLine = (line: string, original: string[], modified: string[]) => {\n if (line.startsWith(\" \")) {\n const text = line.slice(1);\n original.push(text);\n modified.push(text);\n return;\n }\n\n if (line.startsWith(\"-\")) {\n original.push(line.slice(1));\n return;\n }\n\n if (line.startsWith(\"+\")) {\n modified.push(line.slice(1));\n }\n};\n\nconst parseHunkBody = (lines: string[], startIndex: number, original: string[], modified: string[]) => {\n let index = startIndex;\n\n while (index < lines.length) {\n const line = lines[index] || \"\";\n if (isDiffFileBoundary(line) || isHunkHeader(line) || isInvalidHunkBodyLine(line)) {\n break;\n }\n\n appendHunkLine(line, original, modified);\n index += 1;\n }\n\n if (original.length > 0 || modified.length > 0) {\n original.push(\"\");\n modified.push(\"\");\n }\n\n return index;\n};\n\nconst parsePreview = (lines: string[], startIndex: number) => {\n const oldHeader = normalizeHeaderPath((lines[startIndex] || \"\").slice(4));\n const next = lines[startIndex + 1] || \"\";\n if (!isPlusHeader(next)) return { nextIndex: startIndex + 1 } as const;\n\n const newHeader = normalizeHeaderPath(next.slice(4));\n const filePath = newHeader ?? oldHeader ?? \"\";\n const original: string[] = [];\n const modified: string[] = [];\n\n let index = startIndex + 2;\n while (index < lines.length) {\n const current = lines[index] || \"\";\n if (isDiffFileBoundary(current)) break;\n\n if (!isHunkHeader(current)) {\n index += 1;\n continue;\n }\n\n index = parseHunkBody(lines, index + 1, original, modified);\n }\n\n return {\n nextIndex: index,\n preview: { filePath, original: original.join(\"\\n\"), modified: modified.join(\"\\n\") } satisfies FileDiffPreview,\n } as const;\n};\n\nexport function buildFileDiffPreviews(diffText?: string) {\n if (!diffText || typeof diffText !== \"string\") return [] as FileDiffPreview[];\n\n const lines = diffText.split(/\\r?\\n/);\n const previews: FileDiffPreview[] = [];\n\n let i = 0;\n while (i < lines.length) {\n const line = lines[i] || \"\";\n if (!isMinusHeader(line)) {\n i += 1;\n continue;\n }\n\n const { nextIndex, preview } = parsePreview(lines, i);\n if (preview) previews.push(preview);\n i = Math.max(nextIndex, i + 1);\n }\n\n return previews;\n}\n","import type { ToolPart } from \"../components/message-types\";\nimport type { Block, TitleSegment } from \"../components/timeline\";\nimport { basenameSafe, buildDiffTitleSegments, buildFileDiffPreviews, extractDiffFilePaths } from \"../utils/diff\";\nimport { toolTypeToIconName } from \"../utils/get-icon\";\n\nconst TOOL_LABELS: Record<string, string> = {\n apply_patch: \"Apply patch\",\n bash: \"Run command\",\n edit: \"Edit file\",\n glob: \"Find files\",\n grep: \"Search files\",\n read: \"Read file\",\n skill: \"Load skill\",\n todowrite: \"Update todos\",\n};\n\nconst STATE_LABELS: Record<string, string> = {\n error: \"failed\",\n \"output-error\": \"failed\",\n input_streaming: \"running\",\n running: \"running\",\n completed: \"completed\",\n failed: \"failed\",\n};\n\nexport type ApplyPatchMetadataFile = {\n filePath: string;\n additions: number;\n deletions: number;\n diff?: string;\n before?: string;\n after?: string;\n};\n\nexport const normalizeToolType = (value: string) => value.replace(/^tool-/, \"\").toLowerCase();\n\nconst toTitleCase = (value: string) => {\n return value\n .split(\" \")\n .filter((token) => token.length > 0)\n .map((token) => token[0].toUpperCase() + token.slice(1))\n .join(\" \");\n};\n\nexport const getToolType = (invocation: ToolPart) => normalizeToolType(invocation.tool ?? \"tool\");\n\nexport const getToolLabel = (value: string) => {\n const normalized = normalizeToolType(value);\n return TOOL_LABELS[normalized] ?? toTitleCase(normalized.replace(/_/g, \" \"));\n};\n\nexport const getStateLabel = (invocation: ToolPart) => {\n const state = invocation.state?.status ?? invocation.status;\n if (!state || typeof state !== \"string\") return null;\n\n const normalized = state.replace(/-/g, \"_\");\n if (STATE_LABELS[normalized]) return STATE_LABELS[normalized];\n if (normalized.includes(\"stream\")) return \"running\";\n return null;\n};\n\nexport const isErrorState = (invocation: ToolPart) => {\n const state = invocation.state?.status ?? invocation.status;\n return state === \"error\" || state === \"output-error\" || state === \"failed\";\n};\n\nexport const buildIndicator = (invocation: ToolPart) => {\n if (isErrorState(invocation)) {\n return { type: \"icon\", icon: \"danger\" } as const;\n }\n\n return {\n type: \"icon\",\n icon: toolTypeToIconName(getToolType(invocation)),\n } as const;\n};\n\nexport const buildBaseTitle = (\n invocation: ToolPart,\n detail?: string,\n labelOverride?: string,\n detailStyle?: \"monospace\",\n) => {\n const label = labelOverride ?? getToolLabel(invocation.tool ?? \"tool\");\n const title: TitleSegment[] = [{ kind: \"text\", text: label, bold: true }];\n\n if (detail) {\n title.push({\n kind: \"text\",\n text: detail,\n muted: true,\n ...(detailStyle === \"monospace\" ? { truncate: true, monospace: true } : {}),\n });\n }\n\n const stateLabel = getStateLabel(invocation);\n if (stateLabel && stateLabel !== \"completed\") {\n title.push({ kind: \"text\", text: stateLabel, muted: true });\n }\n\n return title;\n};\n\nexport const getInputObject = (invocation: ToolPart) => {\n const input = invocation.state?.input;\n if (!input || typeof input !== \"object\" || Array.isArray(input)) return null;\n return input as Record<string, unknown>;\n};\n\nexport const getOutputObject = (invocation: ToolPart) => {\n const output = invocation.state?.output;\n if (!output || typeof output !== \"object\" || Array.isArray(output)) return null;\n return output as Record<string, unknown>;\n};\n\nexport const getStringValue = (value: unknown) => {\n if (typeof value === \"string\" && value.trim().length > 0) return value;\n return null;\n};\n\nexport const getObjectValue = (value: unknown) => {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return null;\n return value as Record<string, unknown>;\n};\n\nexport const getStateObject = (invocation: ToolPart, key: string) => {\n const state = getObjectValue(invocation.state);\n if (!state) return null;\n return getObjectValue(state[key]);\n};\n\nconst normalizeFilePath = (value: string) => value.replace(/\\\\/g, \"/\").replace(/^\\/+/, \"\");\n\nconst isUnifiedDiff = (value: string) => value.includes(\"--- \") && value.includes(\"+++ \") && value.includes(\"@@\");\n\nconst getApplyPatchMetadataObjects = (invocation: ToolPart) => {\n const output = getOutputObject(invocation);\n return [getStateObject(invocation, \"metadata\"), getObjectValue(output?.metadata)].filter(Boolean) as Array<\n Record<string, unknown>\n >;\n};\n\nconst parseApplyPatchMetadataFile = (entry: unknown) => {\n const record = getObjectValue(entry);\n if (!record) return null;\n\n const rawPath = getStringValue(record.filePath) ?? getStringValue(record.relativePath) ?? getStringValue(record.path);\n if (!rawPath) return null;\n\n return {\n filePath: normalizeFilePath(rawPath),\n additions: typeof record.additions === \"number\" ? record.additions : 0,\n deletions: typeof record.deletions === \"number\" ? record.deletions : 0,\n diff: getStringValue(record.diff) ?? undefined,\n before: getStringValue(record.before) ?? undefined,\n after: getStringValue(record.after) ?? undefined,\n } satisfies ApplyPatchMetadataFile;\n};\n\nexport const getApplyPatchMetadataFiles = (invocation: ToolPart) => {\n const files: ApplyPatchMetadataFile[] = [];\n\n for (const metadata of getApplyPatchMetadataObjects(invocation)) {\n const entries = Array.isArray(metadata.files) ? metadata.files : [];\n\n for (const entry of entries) {\n const parsedFile = parseApplyPatchMetadataFile(entry);\n if (!parsedFile) continue;\n files.push(parsedFile);\n }\n }\n\n return files;\n};\n\nexport const getApplyPatchInputFilePaths = (invocation: ToolPart) => {\n const input = getInputObject(invocation);\n const changes = Array.isArray(input?.changes) ? input.changes : [];\n const filePaths = changes\n .map((change) => getStringValue(getObjectValue(change)?.path))\n .filter((filePath): filePath is string => Boolean(filePath))\n .map(normalizeFilePath);\n\n return Array.from(new Set(filePaths));\n};\n\nexport const getApplyPatchDiffText = (invocation: ToolPart) => {\n const input = getInputObject(invocation);\n const inputDiff = getStringValue(input?.diff);\n if (inputDiff) return inputDiff;\n\n for (const metadata of getApplyPatchMetadataObjects(invocation)) {\n const metadataDiff = getStringValue(metadata.diff);\n if (metadataDiff) return metadataDiff;\n }\n\n const fileDiffs = getApplyPatchMetadataFiles(invocation)\n .map((file) => file.diff)\n .filter((diff): diff is string => Boolean(diff));\n if (fileDiffs.length > 0) return fileDiffs.join(\"\\n\");\n\n const patchText = getStringValue(input?.patchText);\n if (patchText && isUnifiedDiff(patchText)) return patchText;\n\n return null;\n};\n\nexport const buildApplyPatchMetadataTitleSegments = (files: ApplyPatchMetadataFile[]) => {\n const seen = new Set<string>();\n const segments: TitleSegment[] = [];\n\n for (const file of files) {\n if (seen.has(file.filePath)) continue;\n seen.add(file.filePath);\n\n segments.push({\n kind: \"diff\",\n fileName: basenameSafe(file.filePath),\n filePath: file.filePath,\n additions: file.additions,\n deletions: file.deletions,\n });\n }\n\n return segments;\n};\n\nexport const getApplyPatchMetadataReferences = (files: ApplyPatchMetadataFile[]) => {\n return Array.from(new Set(files.map((file) => file.filePath)));\n};\n\nexport const getOutputText = (invocation: ToolPart) => {\n const outputObject = getOutputObject(invocation);\n\n return (\n getStringValue(invocation.state?.output) ??\n getStringValue(outputObject?.returnDisplay) ??\n getStringValue(outputObject?.preview) ??\n getStringValue(outputObject?.stdout) ??\n getStringValue(outputObject?.content)\n );\n};\n\nexport const parseSkillContentBlock = (value: string) => {\n const match = value.match(/<skill_content(?:\\s+name=\"([^\"]+)\")?>([\\s\\S]*?)<\\/skill_content>/);\n if (!match) return null;\n\n return {\n skillName: getStringValue(match[1]) ?? undefined,\n content: getStringValue(match[2]) ?? \"\",\n };\n};\n\nexport const getSkillName = (invocation: ToolPart) => {\n const input = getInputObject(invocation);\n return (\n getStringValue(input?.name) ??\n getStringValue(input?.skillName) ??\n getStringValue(input?.skill) ??\n getStringValue(input?.skill_name) ??\n undefined\n );\n};\n\nexport const buildFileLinkSegment = (filePath: string, variant?: \"default\" | \"bubble\"): TitleSegment => {\n return {\n kind: \"link\",\n text: basenameSafe(filePath),\n filePath,\n ...(variant ? { variant } : {}),\n };\n};\n\nexport const prependErrorBlock = (invocation: ToolPart, blocks: Block[]): Block[] => {\n if (!isErrorState(invocation) || !invocation.state?.errorText) return blocks;\n const errorBlock: Block = {\n type: \"comment\",\n text: invocation.state.errorText,\n };\n return [errorBlock, ...blocks];\n};\n\nexport const getDiffBlocks = (diffText?: string | null) => {\n return buildFileDiffPreviews(diffText ?? undefined).map((preview) => ({\n type: \"diff\",\n language: \"diff\",\n original: preview.original,\n modified: preview.modified,\n sideBySide: false,\n })) satisfies Block[];\n};\n\nexport const getDiffTitleSegments = (diffText?: string | null) => buildDiffTitleSegments(diffText ?? undefined);\n\nexport const getDiffReferences = (diffText?: string | null) => extractDiffFilePaths(diffText ?? undefined);\n","import type { Block, Item } from \"../components/timeline\";\nimport {\n buildApplyPatchMetadataTitleSegments,\n buildBaseTitle,\n buildFileLinkSegment,\n buildIndicator,\n getApplyPatchDiffText,\n getApplyPatchInputFilePaths,\n getApplyPatchMetadataFiles,\n getApplyPatchMetadataReferences,\n getDiffBlocks,\n getDiffReferences,\n getDiffTitleSegments,\n prependErrorBlock,\n} from \"./shared\";\nimport type { ToolRenderer } from \"./types\";\n\nexport const renderApplyPatch: ToolRenderer = (invocation) => {\n const diffText = getApplyPatchDiffText(invocation);\n const metadataFiles = getApplyPatchMetadataFiles(invocation);\n const inputFilePaths = getApplyPatchInputFilePaths(invocation);\n\n const title = buildBaseTitle(invocation, undefined, \"Apply patch\");\n const diffSegments = getDiffTitleSegments(diffText);\n if (diffSegments.length > 0) {\n title.push(...diffSegments);\n } else if (metadataFiles.length > 0) {\n title.push(...buildApplyPatchMetadataTitleSegments(metadataFiles));\n } else {\n title.push(...inputFilePaths.map((filePath) => buildFileLinkSegment(filePath, \"bubble\")));\n }\n\n const blocks: Block[] = [...getDiffBlocks(diffText)];\n\n if (blocks.length === 0) {\n for (const file of metadataFiles) {\n if (!file.before && !file.after) continue;\n blocks.push({\n type: \"diff\",\n language: \"diff\",\n original: file.before ?? \"\",\n modified: file.after ?? \"\",\n sideBySide: false,\n });\n }\n }\n\n if (blocks.length === 0) {\n const references = getDiffReferences(diffText);\n if (references.length === 0) {\n references.push(...getApplyPatchMetadataReferences(metadataFiles));\n }\n if (references.length === 0) {\n references.push(...inputFilePaths);\n }\n if (references.length > 0) {\n blocks.push({ type: \"references\", references });\n }\n }\n\n return {\n indicator: buildIndicator(invocation),\n title,\n blocks: prependErrorBlock(invocation, blocks),\n } satisfies Item;\n};\n","import type { Block, Item } from \"../components/timeline\";\nimport {\n buildBaseTitle,\n buildFileLinkSegment,\n buildIndicator,\n getDiffBlocks,\n getInputObject,\n getOutputObject,\n getStringValue,\n prependErrorBlock,\n} from \"./shared\";\nimport type { ToolRenderer } from \"./types\";\n\nconst buildEditDiff = (original: string, modified: string) => {\n return [\n {\n type: \"diff\",\n language: \"text\",\n original,\n modified,\n sideBySide: false,\n },\n ] satisfies Block[];\n};\n\nexport const renderEdit: ToolRenderer = (invocation) => {\n const input = getInputObject(invocation);\n const output = getOutputObject(invocation);\n\n const filePath =\n getStringValue(input?.filePath) ??\n getStringValue(input?.file_path) ??\n getStringValue(output?.filePath) ??\n undefined;\n\n const original = getStringValue(output?.oldString) ?? getStringValue(input?.old_string) ?? undefined;\n const modified = getStringValue(output?.newString) ?? getStringValue(input?.new_string) ?? undefined;\n\n const title = buildBaseTitle(invocation, undefined, \"Edit file\");\n if (filePath) {\n title.push(buildFileLinkSegment(filePath));\n }\n\n const diffBlocks =\n original !== undefined && modified !== undefined\n ? buildEditDiff(original, modified)\n : getDiffBlocks(getStringValue(output?.diff));\n\n return {\n indicator: buildIndicator(invocation),\n title,\n blocks: prependErrorBlock(invocation, diffBlocks),\n } satisfies Item;\n};\n","import type { ToolPart } from \"../components/message-types\";\nimport type { Block, Item, TitleSegment } from \"../components/timeline\";\nimport { hasQuestionResponse, parseQuestionPrompt } from \"./question-prompt\";\nimport type { ToolRenderer } from \"./types\";\n\ntype QuestionRendererDependencies = {\n buildBaseTitle: (invocation: ToolPart, detail?: string, labelOverride?: string) => TitleSegment[];\n buildIndicator: (invocation: ToolPart) => Item[\"indicator\"];\n prependErrorBlock: (invocation: ToolPart, blocks: Block[]) => Block[];\n};\n\nexport const createQuestionRenderer = (deps: QuestionRendererDependencies): ToolRenderer => {\n const { buildBaseTitle, buildIndicator, prependErrorBlock } = deps;\n\n return (invocation) => {\n const responded = hasQuestionResponse(invocation.state?.output) || hasQuestionResponse(invocation.state?.metadata);\n const prompt = parseQuestionPrompt(invocation.state?.input);\n const block = prompt ? ({ type: \"question-form\", questions: prompt.questions } satisfies Block) : null;\n if (!responded && !block) return null;\n\n const fieldLabel = block ? `${block.questions.length} field${block.questions.length === 1 ? \"\" : \"s\"}` : undefined;\n const blocks = responded ? [] : [block!];\n\n return {\n indicator: buildIndicator(invocation),\n title: buildBaseTitle(invocation, fieldLabel, \"Question\"),\n blocks: prependErrorBlock(invocation, blocks),\n expandable: false,\n } satisfies Item;\n };\n};\n","import type { Block, Item } from \"../components/timeline\";\nimport {\n buildBaseTitle,\n buildFileLinkSegment,\n buildIndicator,\n getInputObject,\n getOutputObject,\n getOutputText,\n getSkillName,\n getStringValue,\n parseSkillContentBlock,\n prependErrorBlock,\n} from \"./shared\";\nimport type { ToolRenderer } from \"./types\";\n\nexport const renderRead: ToolRenderer = (invocation) => {\n const input = getInputObject(invocation);\n const output = getOutputObject(invocation);\n\n const filePath =\n getStringValue(input?.filePath) ??\n getStringValue(input?.file_path) ??\n getStringValue(input?.file) ??\n getStringValue(output?.filePath) ??\n getStringValue(output?.file) ??\n getStringValue(output?.path) ??\n undefined;\n\n const title = buildBaseTitle(invocation, undefined, \"Read file\");\n if (filePath) {\n title.push(buildFileLinkSegment(filePath));\n }\n\n return {\n indicator: buildIndicator(invocation),\n title,\n blocks: prependErrorBlock(invocation, []),\n } satisfies Item;\n};\n\nconst renderCommand = (invocation: Parameters<ToolRenderer>[0], label: string) => {\n const input = getInputObject(invocation);\n const output = getOutputObject(invocation);\n const command = getStringValue(input?.command) ?? undefined;\n\n const title = buildBaseTitle(invocation, command, label, \"monospace\");\n const blocks: Block[] = [];\n\n const outputText = getOutputText(invocation);\n if (outputText) {\n blocks.push({ type: \"code\", language: \"text\", code: outputText });\n }\n\n const stderr = getStringValue(output?.stderr);\n if (stderr && stderr !== outputText) {\n blocks.push({ type: \"code\", language: \"text\", code: stderr });\n }\n\n if (typeof output?.exitCode === \"number\") {\n blocks.push({ type: \"text\", text: `Exit code: ${output.exitCode}` });\n }\n\n return {\n indicator: buildIndicator(invocation),\n title,\n blocks: prependErrorBlock(invocation, blocks),\n } satisfies Item;\n};\n\nexport const renderBash: ToolRenderer = (invocation) => renderCommand(invocation, \"Run command\");\n\nexport const renderShell: ToolRenderer = (invocation) => renderCommand(invocation, \"Shell\");\n\nexport const renderGrep: ToolRenderer = (invocation) => {\n const input = getInputObject(invocation);\n const outputText = getOutputText(invocation);\n const query = getStringValue(input?.pattern) ?? undefined;\n\n const title = buildBaseTitle(invocation, query, \"Search files\");\n const blocks: Block[] = outputText ? [{ type: \"code\", language: \"text\", code: outputText }] : [];\n\n return {\n indicator: buildIndicator(invocation),\n title,\n blocks: prependErrorBlock(invocation, blocks),\n } satisfies Item;\n};\n\nexport const renderGlob: ToolRenderer = (invocation) => {\n const input = getInputObject(invocation);\n const outputText = getOutputText(invocation);\n const pattern = getStringValue(input?.pattern) ?? undefined;\n\n const title = buildBaseTitle(invocation, pattern, \"Find files\");\n const blocks: Block[] = [];\n\n if (outputText) {\n const references = outputText\n .split(/\\r?\\n/)\n .map((line) => line.trim())\n .filter((line) => line.length > 0);\n\n if (references.length > 0) {\n blocks.push({ type: \"references\", references });\n }\n }\n\n return {\n indicator: buildIndicator(invocation),\n title,\n blocks: prependErrorBlock(invocation, blocks),\n } satisfies Item;\n};\n\nexport const renderSkill: ToolRenderer = (invocation) => {\n const outputText = getOutputText(invocation);\n const parsedOutput = outputText ? parseSkillContentBlock(outputText) : null;\n\n const skillName = getSkillName(invocation) ?? parsedOutput?.skillName;\n const title = buildBaseTitle(invocation, skillName, \"Load skill\");\n\n const renderedContent = parsedOutput?.content ?? outputText;\n const blocks: Block[] = renderedContent ? [{ type: \"code\", language: \"markdown\", code: renderedContent }] : [];\n\n return {\n indicator: buildIndicator(invocation),\n title,\n blocks: prependErrorBlock(invocation, blocks),\n } satisfies Item;\n};\n","import type { ToolPart } from \"../components/message-types\";\nimport type { Block, Item, TitleSegment } from \"../components/timeline\";\nimport type { ToolRenderer } from \"./types\";\n\ntype TodoItem = {\n label: string;\n checked: boolean;\n};\n\ntype TodowriteRendererDependencies = {\n buildBaseTitle: (invocation: ToolPart, detail?: string, labelOverride?: string) => TitleSegment[];\n buildIndicator: (invocation: ToolPart) => Item[\"indicator\"];\n prependErrorBlock: (invocation: ToolPart, blocks: Block[]) => Block[];\n};\n\nconst getStringValue = (value: unknown) => {\n if (typeof value === \"string\" && value.trim().length > 0) return value;\n return null;\n};\n\nconst getObjectValue = (value: unknown) => {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return null;\n return value as Record<string, unknown>;\n};\n\nconst parseTodoItem = (value: unknown): TodoItem | null => {\n const todo = getObjectValue(value);\n if (!todo) return null;\n\n const content = getStringValue(todo.content) ?? getStringValue(todo.title);\n if (!content) return null;\n const status = getStringValue(todo.status);\n\n return {\n label: content,\n checked: status === \"completed\",\n };\n};\n\nconst parseTodoItems = (value: unknown) => {\n if (!value) return { items: [], explicit: false };\n\n const listSource = (() => {\n if (Array.isArray(value)) return value;\n const objectValue = getObjectValue(value);\n if (!objectValue || !Array.isArray(objectValue.todos)) return null;\n return objectValue.todos;\n })();\n\n if (!listSource) return { items: [], explicit: false };\n\n return {\n items: listSource.map(parseTodoItem).filter((todo): todo is TodoItem => todo !== null),\n explicit: true,\n };\n};\n\nexport const createTodowriteRenderer = (deps: TodowriteRendererDependencies): ToolRenderer => {\n const { buildBaseTitle, buildIndicator, prependErrorBlock } = deps;\n\n return (invocation) => {\n const inputTodos = parseTodoItems(invocation.state?.input);\n const outputTodos = parseTodoItems(invocation.state?.output);\n const todoState = outputTodos.explicit ? outputTodos : inputTodos;\n if (!todoState.explicit) return null;\n\n const todos = todoState.items;\n const countLabel = `${todos.length} item${todos.length === 1 ? \"\" : \"s\"}`;\n const title = buildBaseTitle(invocation, countLabel, \"Update todos\");\n\n if (todos.length === 0) {\n return {\n indicator: buildIndicator(invocation),\n title,\n blocks: prependErrorBlock(invocation, [{ type: \"comment\", text: \"No todos\" }]),\n } satisfies Item;\n }\n\n const blocks: Block[] = [\n {\n type: \"todo-list\",\n items: todos,\n },\n ];\n\n return {\n indicator: buildIndicator(invocation),\n title,\n blocks: prependErrorBlock(invocation, blocks),\n } satisfies Item;\n };\n};\n","import { renderApplyPatch } from \"./apply-patch-renderer\";\nimport { renderEdit } from \"./edit-renderer\";\nimport { createQuestionRenderer } from \"./question-renderer\";\nimport { buildBaseTitle, buildIndicator, prependErrorBlock } from \"./shared\";\nimport { renderBash, renderGlob, renderGrep, renderRead, renderShell, renderSkill } from \"./standard-renderers\";\nimport { createTodowriteRenderer } from \"./todowrite-renderer\";\nimport type { ToolRenderersMap } from \"./types\";\n\nconst renderQuestion = createQuestionRenderer({\n buildBaseTitle,\n buildIndicator,\n prependErrorBlock,\n});\n\nconst renderTodowrite = createTodowriteRenderer({\n buildBaseTitle,\n buildIndicator,\n prependErrorBlock,\n});\n\nexport const createDefaultToolRenderers = () => {\n return {\n apply_patch: renderApplyPatch,\n bash: renderBash,\n edit: renderEdit,\n glob: renderGlob,\n grep: renderGrep,\n question: renderQuestion,\n read: renderRead,\n shell: renderShell,\n skill: renderSkill,\n todo_write: renderTodowrite,\n todowrite: renderTodowrite,\n } satisfies ToolRenderersMap;\n};\n","import type { ToolPart } from \"../components/message-types\";\nimport type { Block, Item, TitleSegment } from \"../components/timeline\";\nimport { toolTypeToIconName } from \"../utils/get-icon\";\nimport { getToolNameLookupKeys, normalizeToolName } from \"../utils/tool-name\";\nimport { createDefaultToolRenderers } from \"./default-renderers\";\nimport type { ToolRenderersMap, ToolTimelineBuilderOptions } from \"./types\";\n\nconst STATE_LABELS: Record<string, string> = {\n error: \"failed\",\n \"output-error\": \"failed\",\n \"input-streaming\": \"running\",\n};\n\nconst toTitleCase = (value: string) => {\n return value\n .split(\" \")\n .filter((token) => token.length > 0)\n .map((token) => token[0].toUpperCase() + token.slice(1))\n .join(\" \");\n};\n\nconst getToolLabel = (tool?: string) => {\n const normalized = normalizeToolName(tool ?? \"tool\").replace(/_/g, \" \");\n return toTitleCase(normalized);\n};\n\nconst isErrorState = (state?: string) => state === \"error\" || state === \"output-error\";\n\nconst buildIndicator = (invocation: ToolPart) => {\n if (isErrorState(invocation.state?.status)) {\n return { type: \"icon\", icon: \"danger\" } as const;\n }\n\n return { type: \"icon\", icon: toolTypeToIconName(invocation.tool ?? \"tool\") } as const;\n};\n\nconst getStateLabel = (state?: unknown) => {\n if (!state || typeof state !== \"string\") return null;\n if (STATE_LABELS[state]) return STATE_LABELS[state];\n if (state.includes(\"stream\")) return \"running\";\n return null;\n};\n\nconst stringifyValue = (value: unknown) => {\n if (typeof value === \"string\") return value;\n if (value === null || value === undefined) return null;\n\n try {\n return JSON.stringify(value, null, 2);\n } catch {\n return null;\n }\n};\n\nconst isBlankValue = (value: unknown): boolean => {\n if (value === null || value === undefined) return true;\n if (typeof value === \"string\") return value.trim().length === 0;\n if (Array.isArray(value)) return value.length === 0 || value.every(isBlankValue);\n if (typeof value === \"object\") {\n return Object.values(value as Record<string, unknown>).every(isBlankValue);\n }\n return false;\n};\n\nconst getRecord = (value: unknown) => {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return null;\n return value as Record<string, unknown>;\n};\n\nconst getString = (value: unknown) => {\n if (typeof value === \"string\" && value.trim().length > 0) return value;\n return null;\n};\n\nconst getMediaType = (record: Record<string, unknown>) =>\n getString(record.mime_type) ?? getString(record.mediaType) ?? getString(record.mimeType);\n\nconst isImageMediaType = (value: string | null) => Boolean(value?.startsWith(\"image/\"));\n\nconst imageUrlPattern = /\\.(avif|bmp|gif|jpe?g|png|svg|webp)(\\?.*)?$/i;\n\nconst getImageBlock = (value: unknown, alt: string): Block | null => {\n const record = getRecord(value);\n if (!record) return null;\n\n const mediaType = getMediaType(record);\n const data = getString(record.data);\n if (data && isImageMediaType(mediaType)) {\n return { type: \"image\", src: `data:${mediaType};base64,${data}`, alt };\n }\n\n const url = getString(record.url) ?? getString(record.src);\n if (url && (isImageMediaType(mediaType) || imageUrlPattern.test(url))) {\n return { type: \"image\", src: url, alt };\n }\n\n return null;\n};\n\nconst getFileLikeOutput = (value: unknown) => {\n const record = getRecord(value);\n if (!record) return null;\n\n const filePath = getString(record.path) ?? getString(record.filePath) ?? getString(record.filename);\n const content = getString(record.content) ?? getString(record.body) ?? getString(record.text);\n if (!filePath || content === null) return null;\n\n return { filePath, content };\n};\n\nconst extensionLanguageBySuffix: Record<string, string> = {\n css: \"css\",\n html: \"html\",\n js: \"js\",\n json: \"json\",\n jsx: \"jsx\",\n md: \"markdown\",\n py: \"python\",\n ts: \"ts\",\n tsx: \"tsx\",\n yaml: \"yaml\",\n yml: \"yaml\",\n};\n\nconst getLanguageFromPath = (filePath: string) => {\n const extension = filePath.split(\".\").pop()?.toLowerCase();\n if (!extension) return \"text\";\n return extensionLanguageBySuffix[extension] ?? extension;\n};\n\nconst createLabeledBlocks = (label: string, blocks: Block[]) => {\n if (blocks.length === 0) return [];\n return [{ type: \"text\", text: label }, ...blocks] satisfies Block[];\n};\n\nconst buildBlocksForArrayValue = (value: unknown[], alt: string) => {\n const blocks: Block[] = [];\n\n for (const entry of value) {\n const entryRecord = getRecord(entry);\n const entryType = getString(entryRecord?.type);\n if (entryType === \"image\") {\n const image = getImageBlock(entry, alt);\n if (image) blocks.push(image);\n continue;\n }\n if (entryType === \"text\") {\n const text = getString(entryRecord?.text);\n if (text) blocks.push({ type: \"text\", text });\n continue;\n }\n blocks.push(...buildBlocksForValue(entry, alt));\n }\n\n return blocks;\n};\n\nconst buildBlocksForFileLikeValue = (value: unknown) => {\n const fileLikeOutput = getFileLikeOutput(value);\n if (!fileLikeOutput) return null;\n\n return [\n {\n type: \"code\",\n language: getLanguageFromPath(fileLikeOutput.filePath),\n code: fileLikeOutput.content,\n },\n ] satisfies Block[];\n};\n\nconst buildBlocksForAttachmentValue = (value: unknown) => {\n const record = getRecord(value);\n const attachmentName = getString(record?.attachment_name) ?? getString(record?.attachmentName);\n const attachmentId = getString(record?.attachment_file_id) ?? getString(record?.attachmentFileId);\n if (!attachmentName && !attachmentId) return null;\n\n return [{ type: \"text\", text: attachmentName ?? `Attachment ${attachmentId}` }] satisfies Block[];\n};\n\nconst buildBlocksForValue = (value: unknown, alt: string): Block[] => {\n if (isBlankValue(value)) return [];\n\n const imageBlock = getImageBlock(value, alt);\n if (imageBlock) return [imageBlock];\n\n if (Array.isArray(value)) return buildBlocksForArrayValue(value, alt);\n\n const fileBlocks = buildBlocksForFileLikeValue(value);\n if (fileBlocks) return fileBlocks;\n\n const attachmentBlocks = buildBlocksForAttachmentValue(value);\n if (attachmentBlocks) return attachmentBlocks;\n\n const text = stringifyValue(value);\n if (!text?.trim()) return [];\n\n return [{ type: \"code\", language: typeof value === \"string\" ? \"text\" : \"json\", code: text }] satisfies Block[];\n};\n\nconst buildGenericBlocks = (invocation: ToolPart): Block[] => {\n const blocks: Block[] = [];\n const toolLabel = getToolLabel(invocation.tool);\n\n if (isErrorState(invocation.state?.status) && invocation.state?.errorText) {\n blocks.push({ type: \"comment\", text: invocation.state.errorText });\n }\n\n blocks.push(...createLabeledBlocks(\"Input\", buildBlocksForValue(invocation.state?.input, `${toolLabel} input`)));\n blocks.push(...createLabeledBlocks(\"Output\", buildBlocksForValue(invocation.state?.output, `${toolLabel} output`)));\n\n return blocks;\n};\n\nconst createGenericItem = (invocation: ToolPart) => {\n const title: TitleSegment[] = [{ kind: \"text\", text: getToolLabel(invocation.tool), bold: true }];\n const fileLikeOutput = getFileLikeOutput(invocation.state?.output);\n if (fileLikeOutput) {\n title.push({ kind: \"link\", text: fileLikeOutput.filePath, filePath: fileLikeOutput.filePath });\n }\n const stateLabel = getStateLabel(invocation.state?.status);\n if (stateLabel) {\n title.push({ kind: \"text\", text: stateLabel, muted: true });\n }\n\n return {\n indicator: buildIndicator(invocation),\n title,\n blocks: buildGenericBlocks(invocation),\n };\n};\n\nconst isVisibleTitleSegment = (segment: TitleSegment) => {\n if (segment.kind === \"text\" || segment.kind === \"link\") return segment.text.trim().length > 0;\n if (segment.kind === \"diff\") return segment.fileName.trim().length > 0;\n return true;\n};\n\nconst isVisibleBlock = (block: Block) => {\n switch (block.type) {\n case \"comment\":\n case \"code\":\n case \"text\":\n return block.type === \"code\" ? block.code.trim().length > 0 : block.text.trim().length > 0;\n case \"diff\":\n return block.original.trim().length > 0 || block.modified.trim().length > 0;\n case \"image\":\n return block.src.trim().length > 0;\n case \"todo-list\":\n return block.items.length > 0;\n case \"question-form\":\n return block.questions.length > 0;\n case \"references\":\n return block.references.length > 0;\n case \"input\":\n case \"component\":\n return true;\n }\n};\n\nconst isVisibleItem = (item: Item) => {\n const hasTitle = item.title.some(isVisibleTitleSegment);\n const hasBlocks = (item.blocks ?? []).some(isVisibleBlock);\n return hasTitle || hasBlocks;\n};\n\nconst mergeToolRenderers = (overrides?: ToolRenderersMap) => {\n if (!overrides) return createDefaultToolRenderers();\n return { ...createDefaultToolRenderers(), ...overrides } satisfies ToolRenderersMap;\n};\n\nconst getRenderer = (invocation: ToolPart, toolRenderers: ToolRenderersMap) => {\n const rawTool = invocation.tool ?? \"tool\";\n for (const key of getToolNameLookupKeys(rawTool)) {\n const renderer = toolRenderers[key];\n if (renderer) return renderer;\n }\n\n return undefined;\n};\n\nconst renderInvocation = (\n invocation: ToolPart,\n toolRenderers: ToolRenderersMap,\n options?: ToolTimelineBuilderOptions,\n) => {\n const renderer = getRenderer(invocation, toolRenderers);\n if (renderer) {\n const rendered = renderer(invocation, options);\n if (rendered) return rendered;\n }\n\n return createGenericItem(invocation);\n};\n\nexport const buildTimelineDocFromInvocations = (invocations: ToolPart[], options?: ToolTimelineBuilderOptions) => {\n const toolRenderers = mergeToolRenderers(options?.toolRenderers);\n const items = invocations\n .map((invocation) => renderInvocation(invocation, toolRenderers, options))\n .filter(isVisibleItem);\n\n return { items };\n};\n","import { type ComponentProps, lazy, Suspense } from \"react\";\n\nconst Editor = lazy(() => import(\"./diff-editor\").then((module) => ({ default: module.DiffEditor })));\n\nexport const DiffEditor = (props: ComponentProps<typeof Editor>) => (\n <Suspense fallback={null}>\n <Editor {...props} />\n </Suspense>\n);\n","import { Avatar, Timeline as ChakraTimeline, Span } from \"@chakra-ui/react\";\nimport { getIconComponent } from \"../utils/get-icon\";\nimport type { Indicator } from \"./timeline\";\n\nexport function IndicatorView(props: { ind?: Indicator }) {\n const { ind } = props;\n if (!ind || ind.type === \"none\") return null;\n\n if (ind.type === \"icon\") {\n const IndicatorIcon = getIconComponent(ind.icon);\n return (\n <ChakraTimeline.Indicator outline=\"none\" border=\"none\" background=\"bg\" color=\"fg\">\n <Span display=\"inline-flex\" alignItems=\"center\">\n <IndicatorIcon size={14} strokeWidth={1} />\n </Span>\n </ChakraTimeline.Indicator>\n );\n }\n\n return (\n <ChakraTimeline.Indicator>\n <Avatar.Root boxSize=\"full\">\n <Avatar.Image src={ind.src} alt={ind.alt} />\n <Avatar.Fallback background=\"bg.muted\" color=\"fg.muted\" />\n </Avatar.Root>\n </ChakraTimeline.Indicator>\n );\n}\n","import { Avatar, Link, Span } from \"@chakra-ui/react\";\nimport type { MouseEvent } from \"react\";\nimport { DiffBubble } from \"@/components/diff-viewer/diff-bubble\";\nimport { Tooltip } from \"@/components/primitives/tooltip\";\nimport { ChatLinkAnchor } from \"../links/chat-link-anchor\";\nimport { useChatLinkHandler } from \"../links/chat-link-context\";\nimport type { TitleSegment } from \"./timeline\";\n\nconst handleTitleLinkClick = (\n event: MouseEvent<HTMLAnchorElement>,\n seg: Extract<TitleSegment, { kind: \"link\" }>,\n onOpenFile?: (filePath: string) => void,\n stopPropagation = false,\n) => {\n if (stopPropagation) {\n event.stopPropagation();\n }\n\n if (!seg.href) {\n event.preventDefault();\n }\n if (seg.filePath) {\n onOpenFile?.(seg.filePath);\n }\n};\n\nfunction AvatarTitleSegment({ seg }: { seg: Extract<TitleSegment, { kind: \"avatar\" }> }) {\n return (\n <Avatar.Root width=\"1.5rem\" height=\"1.5rem\">\n <Avatar.Image src={seg.src} alt={seg.alt} />\n <Avatar.Fallback background=\"bg.muted\" color=\"fg.muted\" />\n </Avatar.Root>\n );\n}\n\nfunction DiffTitleSegment({\n seg,\n onOpenFile,\n}: {\n seg: Extract<TitleSegment, { kind: \"diff\" }>;\n onOpenFile?: (filePath: string) => void;\n}) {\n return (\n <DiffBubble\n fileName={seg.fileName}\n additions={seg.additions ?? 0}\n deletions={seg.deletions ?? 0}\n onClickFileLink={() => {\n const path = seg.filePath ?? seg.fileName;\n onOpenFile?.(path);\n }}\n />\n );\n}\n\nfunction BubbleLinkTitleSegment({\n seg,\n onOpenFile,\n}: {\n seg: Extract<TitleSegment, { kind: \"link\" }>;\n onOpenFile?: (filePath: string) => void;\n}) {\n const fontWeight = seg.bold ? \"medium\" : undefined;\n const isInteractive = Boolean(seg.href || seg.filePath);\n\n return (\n <Link\n href={seg.href ?? \"#\"}\n fontWeight={fontWeight}\n color={seg.muted ? \"fg.muted\" : \"fg.muted\"}\n textDecoration=\"none\"\n cursor={isInteractive ? \"pointer\" : \"default\"}\n onClick={(event) => handleTitleLinkClick(event, seg, onOpenFile, true)}\n _hover={{\n textDecoration: \"underline\",\n color: seg.muted ? \"fg.muted\" : \"fg.blue-dark\",\n }}\n >\n {seg.text}\n </Link>\n );\n}\n\nfunction DefaultLinkTitleSegment({\n seg,\n onOpenFile,\n}: {\n seg: Extract<TitleSegment, { kind: \"link\" }>;\n onOpenFile?: (filePath: string) => void;\n}) {\n const fontWeight = seg.bold ? \"medium\" : undefined;\n\n return (\n <Link\n href={seg.href ?? \"#\"}\n fontWeight={fontWeight}\n color={seg.muted ? \"fg.muted\" : \"accent.primary\"}\n textDecoration=\"underline\"\n onClick={(event) => handleTitleLinkClick(event, seg, onOpenFile)}\n _hover={{\n color: seg.muted ? \"fg.muted\" : \"accent.primary\",\n textDecoration: \"underline\",\n }}\n >\n {seg.text}\n </Link>\n );\n}\n\nfunction TextTitleSegment({\n seg,\n isClickable,\n}: {\n seg: Extract<TitleSegment, { kind: \"text\" }>;\n isClickable?: boolean;\n}) {\n const segment = (\n <Span\n fontWeight={seg.bold ? \"medium\" : undefined}\n textStyle={seg.monospace ? \"mono/XS\" : undefined}\n color=\"fg.muted\"\n minW={seg.truncate ? \"0\" : undefined}\n overflow={seg.truncate ? \"hidden\" : undefined}\n textOverflow={seg.truncate ? \"ellipsis\" : undefined}\n whiteSpace={seg.truncate ? \"nowrap\" : undefined}\n _groupHover={{\n color: isClickable && !seg.muted ? \"fg\" : \"fg.muted\",\n }}\n >\n {seg.text}\n </Span>\n );\n\n if (!seg.truncate) return segment;\n\n return <Tooltip content={seg.text}>{segment}</Tooltip>;\n}\n\nexport function TitleInline({\n seg,\n isClickable,\n onOpenFile,\n}: {\n seg: TitleSegment;\n isClickable?: boolean;\n onOpenFile?: (filePath: string) => void;\n}) {\n const handler = useChatLinkHandler();\n if (handler && (seg.kind === \"link\" || seg.kind === \"diff\") && (seg.filePath || seg.kind === \"diff\")) {\n const path = seg.filePath ?? (seg.kind === \"diff\" ? seg.fileName : seg.text);\n return (\n <ChatLinkAnchor candidate={{ source: path, origin: \"tool\" }}>\n {seg.kind === \"diff\" ? (\n <DiffBubble fileName={seg.fileName} additions={seg.additions ?? 0} deletions={seg.deletions ?? 0} />\n ) : (\n seg.text\n )}\n </ChatLinkAnchor>\n );\n }\n switch (seg.kind) {\n case \"avatar\":\n return <AvatarTitleSegment seg={seg} />;\n case \"diff\":\n return <DiffTitleSegment seg={seg} onOpenFile={onOpenFile} />;\n case \"link\":\n return seg.variant === \"bubble\" ? (\n <BubbleLinkTitleSegment seg={seg} onOpenFile={onOpenFile} />\n ) : (\n <DefaultLinkTitleSegment seg={seg} onOpenFile={onOpenFile} />\n );\n case \"text\":\n return <TextTitleSegment seg={seg} isClickable={isClickable} />;\n default:\n return null;\n }\n}\n","import { Box, Button, Card, Timeline as ChakraTimeline, Image, Span, Stack, Text } from \"@chakra-ui/react\";\nimport { ChevronUpIcon } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\nimport { useState } from \"react\";\nimport { DiffEditor } from \"@/components/diff-viewer/lazy-diff-editor\";\nimport { ResourceBadge } from \"@/components/primitives/resource-badge\";\nimport { ScrollArea } from \"@/components/primitives/scroll-area\";\nimport type { ChatLinkProps } from \"../links/chat-link\";\nimport { ChatLinkAnchor } from \"../links/chat-link-anchor\";\nimport { ChatLinkProvider, useChatLinkHandler } from \"../links/chat-link-context\";\nimport type { IconName } from \"../utils/get-icon\";\nimport { IndicatorView } from \"./timeline-indicator\";\nimport { TitleInline } from \"./timeline-title\";\nimport { QuestionFormBlockView, TodoListBlockView } from \"./timeline-tool-blocks\";\n\nconst Timeline = ChakraTimeline;\n\nexport type TimelineDoc = {\n items: Item[];\n};\n\nexport type Item = {\n id?: string;\n timestamp?: string;\n indicator?: Indicator;\n title: TitleSegment[];\n blocks?: Block[];\n expandable?: boolean;\n};\n\nexport type Indicator =\n | { type: \"icon\"; icon: IconName; color?: string }\n | { type: \"avatar\"; src: string; alt?: string }\n | { type: \"none\" };\n\nexport type TitleSegment =\n | {\n kind: \"text\";\n text: string;\n bold?: boolean;\n muted?: boolean;\n truncate?: boolean;\n monospace?: boolean;\n }\n | { kind: \"avatar\"; src: string; alt?: string }\n | {\n kind: \"diff\";\n fileName: string;\n filePath?: string;\n additions?: number;\n deletions?: number;\n }\n | {\n kind: \"link\";\n text: string;\n href?: string;\n filePath?: string;\n bold?: boolean;\n muted?: boolean;\n variant?: \"default\" | \"bubble\";\n };\n\nexport type TodoListBlockItem = {\n label: string;\n checked: boolean;\n};\n\nexport type QuestionFormBlockOption = {\n label: string;\n description?: string;\n};\n\nexport type QuestionFormBlockQuestion = {\n id?: string;\n question: string;\n options: QuestionFormBlockOption[];\n multiple: boolean;\n required: boolean;\n allowCustomAnswer: boolean;\n};\n\nexport type Block =\n | { type: \"comment\"; text: string; reactions?: { clap?: number } }\n | { type: \"code\"; language: string; code: string; editable?: boolean }\n | {\n type: \"diff\";\n language?: string;\n original: string;\n modified: string;\n sideBySide?: boolean;\n }\n | { type: \"input\"; placeholder?: string }\n | { type: \"text\"; text: string }\n | { type: \"todo-list\"; items: TodoListBlockItem[] }\n | { type: \"question-form\"; questions: QuestionFormBlockQuestion[] }\n | { type: \"references\"; references: string[] }\n | { type: \"image\"; src: string; alt: string; caption?: string }\n | {\n type: \"component\";\n render: (ctx: { onOpenFile?: (filePath: string) => void }) => ReactNode;\n };\n\nfunction CodeBlock({ code, language }: { code: string; language?: string }) {\n return (\n <ScrollArea\n background=\"bg.code\"\n color=\"fg.muted\"\n borderWidth=\"1px\"\n borderColor=\"border.subtle\"\n borderRadius=\"md\"\n showHorizontalScrollbar\n showVerticalScrollbar={false}\n >\n <Box\n as=\"pre\"\n padding=\"sm\"\n textStyle=\"mono/XS\"\n whiteSpace=\"pre\"\n aria-label={language ? `${language} code block` : \"code block\"}\n >\n <Box as=\"code\">{code}</Box>\n </Box>\n </ScrollArea>\n );\n}\n\nfunction BlockView({ b, onOpenFile }: { b: Block; onOpenFile?: (filePath: string) => void }) {\n switch (b.type) {\n case \"comment\":\n return (\n <Card.Root>\n <Card.Body>{b.text}</Card.Body>\n {b.reactions?.clap ? (\n <Card.Footer>\n <Button>👏 {b.reactions.clap}</Button>\n </Card.Footer>\n ) : null}\n </Card.Root>\n );\n case \"code\":\n return (\n <Card.Root border=\"0\" padding=\"0\">\n <Card.Body padding=\"0\">\n <CodeBlock language={b.language} code={b.code} />\n </Card.Body>\n </Card.Root>\n );\n case \"diff\":\n return (\n <Card.Root border=\"0\" padding=\"0\">\n <Card.Body padding=\"0\">\n <Box height=\"240px\" minW=\"320px\" overflow=\"hidden\">\n <DiffEditor\n original={b.original}\n modified={b.modified}\n language={b.language}\n sideBySide={b.sideBySide ?? false}\n disableScroll={true}\n />\n </Box>\n </Card.Body>\n </Card.Root>\n );\n case \"text\":\n return (\n <Card.Root background=\"transparent\">\n <Card.Body padding=\"sm\">\n <Text textStyle=\"label/S/regular\">{b.text}</Text>\n </Card.Body>\n </Card.Root>\n );\n case \"todo-list\":\n return <TodoListBlockView items={b.items} />;\n case \"question-form\":\n return <QuestionFormBlockView questions={b.questions} />;\n case \"references\":\n return (\n <Stack mt=\"xs\" gap=\"xs\" flexDir=\"row\" flexWrap=\"wrap\">\n {b.references.map((ref) => (\n <ChatLinkAnchor key={ref} candidate={{ source: ref, origin: \"tool\" }}>\n <ResourceBadge fileName={ref} />\n </ChatLinkAnchor>\n ))}\n </Stack>\n );\n case \"image\":\n if (!b.src.trim()) return null;\n return (\n <Card.Root border=\"0\" padding=\"0\" background=\"transparent\">\n <Card.Body padding=\"0\">\n <Image\n src={b.src}\n alt={b.alt}\n maxH=\"18rem\"\n maxW=\"full\"\n objectFit=\"contain\"\n borderRadius=\"sm\"\n borderWidth=\"1px\"\n borderColor=\"border.subtle\"\n />\n {b.caption ? (\n <Text mt=\"2xs\" textStyle=\"label/XS/regular\" color=\"fg.muted\">\n {b.caption}\n </Text>\n ) : null}\n </Card.Body>\n </Card.Root>\n );\n case \"component\":\n return <>{b.render({ onOpenFile })}</>;\n }\n}\n\nfunction TimelineItemRow({\n item,\n itemKey,\n isOpen,\n canExpand,\n hasBlocks,\n onToggle,\n onOpenFile,\n}: {\n item: Item;\n itemKey: string;\n isOpen: boolean;\n canExpand: boolean;\n hasBlocks: boolean;\n onToggle: (key: string) => void;\n onOpenFile?: (filePath: string) => void;\n}) {\n return (\n <Timeline.Item gap=\"xs\" key={itemKey}>\n <Timeline.Connector>\n <Timeline.Separator />\n <IndicatorView ind={item.indicator} />\n </Timeline.Connector>\n <Timeline.Content h={isOpen ? \"auto\" : \"20px\"}>\n {item.title.length > 0 && (\n <Timeline.Title\n className=\"group\"\n fontWeight=\"normal\"\n display=\"flex\"\n alignItems=\"center\"\n minW=\"0\"\n width=\"full\"\n overflow=\"hidden\"\n cursor={canExpand ? \"pointer\" : \"default\"}\n onClick={canExpand ? () => onToggle(itemKey) : undefined}\n >\n <Span display=\"flex\" alignItems=\"center\" gap=\"sm\" flexWrap=\"nowrap\" minW=\"0\" width=\"full\">\n <Span display=\"flex\" alignItems=\"center\" gap=\"xs\" flexWrap=\"nowrap\" minW=\"0\" flex=\"1\" overflow=\"hidden\">\n {item.title.map((seg, i) => (\n <TitleInline key={i} seg={seg} isClickable={canExpand} onOpenFile={onOpenFile} />\n ))}\n </Span>\n {canExpand ? (\n <Span\n display=\"inline-flex\"\n alignItems=\"center\"\n transition=\"transform 200ms ease, color 200ms ease\"\n transform={isOpen ? \"rotate(0deg)\" : \"rotate(-180deg)\"}\n color=\"transparent\"\n flexShrink=\"0\"\n _groupHover={{ color: \"fg\" }}\n >\n <ChevronUpIcon size={12} />\n </Span>\n ) : null}\n </Span>\n </Timeline.Title>\n )}\n {hasBlocks ? (\n <Box display=\"grid\" gridTemplateRows={isOpen ? \"1fr\" : \"0fr\"} transition=\"grid-template-rows 220ms ease\">\n {isOpen ? (\n <Box\n overflow=\"hidden\"\n opacity={1}\n transform=\"translateY(0)\"\n transition=\"opacity 200ms ease, transform 200ms ease\"\n >\n {item.blocks!.map((block, i) => (\n <Box key={i}>\n <BlockView b={block} onOpenFile={onOpenFile} />\n </Box>\n ))}\n </Box>\n ) : null}\n </Box>\n ) : null}\n </Timeline.Content>\n </Timeline.Item>\n );\n}\n\ninterface TimelineFromJSONProps extends ChatLinkProps {\n data: TimelineDoc;\n}\n\nexport function TimelineFromJSON(props: TimelineFromJSONProps) {\n const inherited = useChatLinkHandler();\n return (\n <ChatLinkProvider handler={props.linkHandler ?? inherited}>\n <TimelineContent {...props} />\n </ChatLinkProvider>\n );\n}\n\nfunction TimelineContent(props: TimelineFromJSONProps) {\n const { data } = props;\n const handler = useChatLinkHandler();\n const openFile = handler\n ? (path: string) => {\n void handler.open({ source: path, origin: \"tool\" });\n }\n : undefined;\n const [expanded, setExpanded] = useState<Record<string, boolean>>({});\n\n const getKey = (it: Item, idx: number) => (it.id ? `id:${it.id}` : `idx:${idx}`);\n\n const toggle = (key: string) => {\n setExpanded((prev) => ({ ...prev, [key]: !prev[key] }));\n };\n\n return (\n <Timeline.Root variant=\"tool\">\n {data.items.map((item, idx) => {\n const key = getKey(item, idx);\n const hasBlocks = (item.blocks?.length ?? 0) > 0;\n const canExpand = (item.expandable ?? true) && hasBlocks;\n const isOpen = canExpand ? (expanded[key] ?? false) : hasBlocks;\n\n return (\n <TimelineItemRow\n key={key}\n item={item}\n itemKey={key}\n isOpen={isOpen}\n canExpand={canExpand}\n hasBlocks={hasBlocks}\n onToggle={toggle}\n onOpenFile={openFile}\n />\n );\n })}\n </Timeline.Root>\n );\n}\n","import type { ChatLinkProps } from \"../links/chat-link\";\nimport { buildTimelineDocFromInvocations } from \"../tool-rendering\";\nimport { normalizeToolName } from \"../utils/tool-name\";\nimport type { ToolPart } from \"./message-types\";\nimport { TimelineFromJSON } from \"./timeline\";\n\nexport interface ToolInvocationTimelineProps extends ChatLinkProps {\n invocations: ToolPart[];\n labeledBlocks?: boolean;\n hideQuestionForms?: boolean;\n}\n\nconst isQuestionTool = (invocation: ToolPart) =>\n normalizeToolName(invocation.tool ?? \"\").replace(/_/g, \"\") === \"question\";\n\nconst hasToolOutput = (invocation: ToolPart) => {\n const output = invocation.state?.output;\n if (typeof output === \"string\") return output.trim().length > 0;\n if (Array.isArray(output)) return output.length > 0;\n if (output && typeof output === \"object\") return Object.keys(output).length > 0;\n return output !== undefined && output !== null;\n};\n\nexport function ToolInvocationTimeline(props: ToolInvocationTimelineProps) {\n const { invocations, labeledBlocks, hideQuestionForms = false, linkHandler } = props;\n const visibleInvocations = hideQuestionForms\n ? invocations.filter((invocation) => !isQuestionTool(invocation) || hasToolOutput(invocation))\n : invocations;\n\n if (visibleInvocations.length === 0) return null;\n\n const data = buildTimelineDocFromInvocations(visibleInvocations, { labeledBlocks });\n\n return <TimelineFromJSON data={data} linkHandler={linkHandler} />;\n}\n","import { Box, Image, Spinner } from \"@chakra-ui/react\";\nimport type { ReactNode } from \"react\";\nimport { AlertMessage } from \"@/components/primitives/alert\";\nimport { ResourceBadge } from \"@/components/primitives/resource-badge\";\nimport { RichMessage } from \"@/components/rich-text\";\nimport {\n ChatImageSourcesContext,\n emptyChatImageSources,\n indexChatImageSources,\n useChatImageHistory,\n} from \"../links/chat-image-sources\";\nimport type { ChatLinkProps } from \"../links/chat-link\";\nimport { ChatLinkProvider, useChatLinkHandler } from \"../links/chat-link-context\";\nimport { parseQuestionPrompt } from \"../tool-rendering/question-prompt\";\nimport { Response } from \"./ai-response\";\nimport { ChatQuestionBubble } from \"./chat-question-bubble\";\nimport type { AlertPart, ChatMessagePart, ErrorPart, FilePart, SessionMessage, ToolPart } from \"./message-types\";\nimport { ToolInvocationTimeline, type ToolInvocationTimelineProps } from \"./tool-invocation-timeline\";\n\ntype ToolInvocationTimelineComponent = (props: ToolInvocationTimelineProps) => ReactNode;\n\nexport interface MessagePartsProps extends ChatLinkProps {\n message: SessionMessage;\n streaming?: boolean;\n hideQuestionForms?: boolean;\n toolInvocationTimeline?: ToolInvocationTimelineComponent;\n}\n\nconst isToolPart = (part: ChatMessagePart): part is ToolPart => {\n return part.type === \"tool\";\n};\n\nconst filePartLabel = (part: FilePart) => part.filename ?? part.url.split(\"/\").pop() ?? \"attachment\";\n\nconst imageExtensionPattern = /\\.(avif|bmp|gif|jpe?g|png|svg|webp)$/i;\n\nconst isImageFilePart = (part: FilePart) =>\n part.mediaType?.startsWith(\"image/\") || imageExtensionPattern.test(filePartLabel(part));\n\nconst filePartThumbnail = (part: FilePart) =>\n isImageFilePart(part) ? (\n <Image\n src={part.url}\n alt={`${filePartLabel(part)} preview thumbnail`}\n boxSize=\"18px\"\n borderRadius=\"xs\"\n objectFit=\"cover\"\n />\n ) : undefined;\n\nconst openFilePart = (part: FilePart, linkHandler?: import(\"../links/chat-link\").ChatLinkHandler) => {\n if (linkHandler) {\n void linkHandler.open({ source: part.url, origin: \"reference\" });\n return;\n }\n\n if (typeof window !== \"undefined\") {\n window.open(part.url, \"_blank\", \"noopener,noreferrer\");\n }\n};\n\nconst getErrorMessage = (part: ErrorPart) => {\n if (part.message && part.message.trim().length > 0) {\n return part.message;\n }\n\n const { errorType } = part;\n switch (errorType) {\n case \"timeout\":\n return \"Session timed out.\";\n case \"crash\":\n return \"Session crashed unexpectedly.\";\n case \"permission\":\n return \"Permission denied.\";\n default:\n return \"An error occurred.\";\n }\n};\n\nconst ALERT_COLOR_PALETTE: Record<AlertPart[\"status\"], string> = {\n info: \"blue\",\n warning: \"orange\",\n error: \"red\",\n success: \"green\",\n loading: \"blue\",\n};\n\nconst collectToolInvocations = (parts: ChatMessagePart[], startIndex: number) => {\n const invocations: ToolPart[] = [];\n let lookahead = startIndex;\n\n while (lookahead < parts.length) {\n const nextPart = parts[lookahead];\n if (!isToolPart(nextPart) || (nextPart.tool === \"question\" && parseQuestionPrompt(nextPart.state?.input))) break;\n invocations.push(nextPart);\n lookahead += 1;\n }\n\n return { invocations, nextIndex: lookahead - 1 };\n};\n\nexport function MessagePartsRenderer(props: MessagePartsProps) {\n const inherited = useChatLinkHandler();\n return (\n <ChatLinkProvider handler={props.linkHandler ?? inherited}>\n <MessagePartsContent {...props} />\n </ChatLinkProvider>\n );\n}\n\nfunction MessagePartsContent(props: MessagePartsProps) {\n const { message, streaming = false, hideQuestionForms = false, toolInvocationTimeline } = props;\n const linkHandler = useChatLinkHandler();\n const imageHistory = useChatImageHistory();\n const localImages = indexChatImageSources([message], linkHandler);\n const RenderToolInvocationTimeline = toolInvocationTimeline ?? ToolInvocationTimeline;\n const parts = message.parts ?? [];\n const nodes: ReactNode[] = [];\n\n for (let partIndex = 0; partIndex < parts.length; partIndex += 1) {\n const part = parts[partIndex];\n const key = `${message.id}-${partIndex}`;\n\n switch (part.type) {\n case \"text\":\n nodes.push(\n <ChatImageSourcesContext\n key={key}\n value={imageHistory.get(part) ?? localImages.get(part) ?? emptyChatImageSources}\n >\n <div>\n <Response streaming={streaming}>{part.text}</Response>\n </div>\n </ChatImageSourcesContext>,\n );\n break;\n case \"reasoning\":\n nodes.push(\n <Box\n key={key}\n padding=\"0\"\n css={{\n \"& .rich-text, & .rich-text *\": {\n color: \"fg.subtle !important\",\n fontSize: \".75rem !important\",\n fontWeight: \"normal !important\",\n },\n }}\n >\n <RichMessage defaultState={part.text} fullWidth />\n </Box>,\n );\n break;\n case \"tool\": {\n if (part.tool === \"question\" && parseQuestionPrompt(part.state?.input)) {\n nodes.push(<ChatQuestionBubble key={key} part={part} />);\n break;\n }\n const { invocations, nextIndex } = collectToolInvocations(parts, partIndex);\n partIndex = nextIndex;\n nodes.push(\n <Box key={key} width=\"full\">\n <RenderToolInvocationTimeline\n invocations={invocations}\n linkHandler={linkHandler}\n labeledBlocks\n hideQuestionForms={hideQuestionForms}\n />\n </Box>,\n );\n break;\n }\n case \"file\":\n nodes.push(\n <Box key={key} width=\"fit-content\">\n <ResourceBadge\n fileName={filePartLabel(part)}\n size=\"sm\"\n tone=\"neutral\"\n icon={filePartThumbnail(part)}\n onSelect={() => openFilePart(part, linkHandler)}\n />\n </Box>,\n );\n break;\n case \"error\":\n nodes.push(\n <Box key={key} py=\"2\" width=\"full\">\n <AlertMessage borderRadius=\"xs\" status=\"error\" colorPalette=\"red\" title={getErrorMessage(part)} size=\"sm\" />\n </Box>,\n );\n break;\n case \"token_usage\":\n break;\n case \"alert\":\n nodes.push(\n <Box key={key} width=\"full\">\n <AlertMessage\n borderRadius=\"xs\"\n status={part.status === \"loading\" ? \"info\" : part.status}\n colorPalette={ALERT_COLOR_PALETTE[part.status]}\n title={part.title}\n icon={part.status === \"loading\" ? <Spinner size=\"sm\" /> : undefined}\n size=\"sm\"\n >\n {part.message}\n </AlertMessage>\n </Box>,\n );\n break;\n default:\n nodes.push(null);\n }\n }\n\n return <>{nodes}</>;\n}\n","// Keep the non-alert session parts aligned with pstdio-api-contracts/src/session-messages.ts.\n// @pstdio/ui cannot import that private package, so the public UI contract owns this copy.\nexport type SessionMessageRole = \"user\" | \"assistant\" | \"tool\" | \"system\" | \"developer\";\n\nexport type TextPart = { type: \"text\"; text: string };\n\nexport type ReasoningPart = { type: \"reasoning\"; text: string };\n\nexport type ToolPartActionType = \"read\" | \"write\" | \"execute\" | \"network\" | \"other\";\n\nexport type ToolPartStatus = \"pending\" | \"running\" | \"completed\" | \"failed\" | \"denied\";\n\nexport type ToolPart = {\n type: \"tool\";\n tool: string;\n callId?: string;\n actionType?: ToolPartActionType;\n status?: ToolPartStatus;\n state?: {\n status?: string;\n input?: unknown;\n output?: unknown;\n errorText?: string;\n metadata?: unknown;\n };\n};\n\nexport type StepStartPart = { type: \"step-start\"; snapshot?: string };\n\nexport type StepFinishPart = {\n type: \"step-finish\";\n reason?: string;\n snapshot?: string;\n cost?: number;\n tokens?: unknown;\n};\n\nexport type PatchPart = { type: \"patch\"; hash?: string; files?: unknown };\n\nexport type FilePart = {\n type: \"file\";\n fileId?: string;\n mediaType?: string;\n filename?: string;\n size?: number;\n url: string;\n};\n\nexport type LoadingPart = { type: \"loading\" };\n\nexport type ErrorPart = {\n type: \"error\";\n errorType: \"timeout\" | \"crash\" | \"permission\" | \"other\";\n message?: string;\n};\n\nexport type TokenUsagePart = {\n type: \"token_usage\";\n inputTokens: number;\n outputTokens: number;\n cacheReadTokens?: number;\n cacheWriteTokens?: number;\n};\n\nexport type AlertPart = {\n type: \"alert\";\n status: \"info\" | \"warning\" | \"error\" | \"success\" | \"loading\";\n title: string;\n message?: string;\n};\n\nexport type SessionMessagePart =\n | TextPart\n | ReasoningPart\n | ToolPart\n | StepStartPart\n | StepFinishPart\n | PatchPart\n | FilePart\n | LoadingPart\n | ErrorPart\n | TokenUsagePart;\n\nexport type ChatMessagePart = SessionMessagePart | AlertPart;\n\nexport type SessionMessage = {\n id: string;\n role: SessionMessageRole;\n parts: ChatMessagePart[];\n index?: number;\n createdAt?: number;\n // A message the user sent that never reached the server. It stays in the conversation until resent or removed.\n delivery?: \"unsent\";\n modelId?: string;\n providerId?: string;\n tokens?: {\n input?: number;\n output?: number;\n reasoning?: number;\n cache?: { read?: number; write?: number };\n };\n};\n\nexport type QueuedFollowUp = {\n /** The request is being saved. Queue actions become available after it is accepted. */\n sending?: boolean;\n revision?: string;\n model?: string | null;\n params?: Record<string, string | boolean>;\n steeringUnavailableReason?: string | null;\n steeringDelivery?: { id: string; runStartedAt: string } | null;\n id: string;\n prompt: string;\n attachments?: Array<{\n id: string;\n name: string;\n size?: number;\n mediaType?: string;\n url?: string;\n }>;\n position?: number;\n};\n\nexport type MessageOrigin = \"user\" | \"assistant\" | \"developer\";\n\nexport const getMessageOrigin = (role: string): MessageOrigin => {\n if (role === \"user\" || role === \"assistant\" || role === \"developer\") return role;\n return \"assistant\";\n};\n\nconst isReasoningToolOnlyMessage = (message: SessionMessage) => {\n const parts = message.parts ?? [];\n if (parts.length === 0) return false;\n\n const hasTextPart = parts.some((part) => part.type === \"text\" && \"text\" in part);\n if (hasTextPart) return false;\n\n return parts.some((part) => part.type === \"reasoning\" || part.type === \"tool\");\n};\n\nconst isVisibleText = (part: TextPart | ReasoningPart) => part.text.trim().length > 0;\n\nconst isVisibleAlert = (part: AlertPart) => part.title.trim().length > 0 || Boolean(part.message?.trim());\n\nconst isDisplayRenderablePart = (part: ChatMessagePart) => {\n switch (part.type) {\n case \"text\":\n case \"reasoning\":\n return isVisibleText(part);\n case \"tool\":\n case \"file\":\n case \"error\":\n return true;\n case \"alert\":\n return isVisibleAlert(part);\n default:\n return false;\n }\n};\n\n// Questions are interaction content and must remain visible even without a later assistant response.\nconst isActivityPart = (part: ChatMessagePart) =>\n part.type === \"reasoning\" || (part.type === \"tool\" && part.tool.toLowerCase() !== \"question\");\n\nconst isActivityOnlyMessage = (message: SessionMessage) => {\n if (message.role === \"user\") return false;\n if (message.parts.length === 0) return false;\n return message.parts.every(isActivityPart);\n};\n\nconst mergeBufferedActivity = (messages: SessionMessage[]) => {\n if (messages.length === 0) return null;\n\n const [first, ...rest] = messages;\n if (!first) return null;\n\n return {\n ...first,\n role: \"assistant\",\n parts: messages.flatMap((message) => message.parts),\n modelId: rest.at(-1)?.modelId ?? first.modelId,\n providerId: rest.at(-1)?.providerId ?? first.providerId,\n } satisfies SessionMessage;\n};\n\nexport const mergeReasoningToolOnlyMessages = (messages: SessionMessage[]) => {\n const merged: SessionMessage[] = [];\n\n for (const message of messages) {\n const previous = merged[merged.length - 1];\n\n if (previous && previous.role === message.role && isReasoningToolOnlyMessage(message)) {\n previous.parts = [...(previous.parts ?? []), ...(message.parts ?? [])];\n continue;\n }\n\n merged.push({\n ...message,\n parts: [...(message.parts ?? [])],\n });\n }\n\n return merged;\n};\n\nexport const normalizeChatMessagesForDisplay = (messages: SessionMessage[], options: { streaming?: boolean } = {}) => {\n const normalized: SessionMessage[] = [];\n let activityBuffer: SessionMessage[] = [];\n\n const clearActivityBuffer = () => {\n activityBuffer = [];\n };\n\n for (const message of messages) {\n const displayParts = (message.parts ?? []).filter(isDisplayRenderablePart);\n if (displayParts.length === 0) continue;\n\n const displayMessage = displayParts.length === message.parts.length ? message : { ...message, parts: displayParts };\n\n if (displayMessage.role === \"user\") {\n clearActivityBuffer();\n normalized.push(displayMessage);\n continue;\n }\n\n if (isActivityOnlyMessage(displayMessage)) {\n activityBuffer.push(displayMessage);\n continue;\n }\n\n if (activityBuffer.length > 0) {\n normalized.push({\n ...displayMessage,\n parts: [...activityBuffer.flatMap((activity) => activity.parts), ...displayMessage.parts],\n });\n clearActivityBuffer();\n continue;\n }\n\n normalized.push(displayMessage);\n }\n\n if (options.streaming && activityBuffer.length > 0) {\n const trailingActivity = mergeBufferedActivity(activityBuffer);\n if (trailingActivity) normalized.push(trailingActivity);\n }\n\n return normalized;\n};\n\nexport interface MessageGroup {\n userMessage: SessionMessage;\n responses: SessionMessage[];\n}\n\nexport const getAssistantMessageActionTargetId = (messages: SessionMessage[]) => {\n const lastMessage = messages.at(-1);\n if (lastMessage?.role !== \"assistant\") return null;\n\n const hasVisibleText = lastMessage.parts.some((part) => part.type === \"text\" && isVisibleText(part));\n return hasVisibleText ? lastMessage.id : null;\n};\n\n// Groups messages into turns: each group starts with a user message\n// followed by all non-user messages until the next user message.\nexport const groupMessagesByTurn = (messages: SessionMessage[]) => {\n const groups: MessageGroup[] = [];\n const leadingResponses: SessionMessage[] = [];\n\n for (const message of messages) {\n if (message.role === \"user\") {\n groups.push({ userMessage: message, responses: [] });\n } else if (groups.length > 0) {\n groups[groups.length - 1].responses.push(message);\n } else {\n leadingResponses.push(message);\n }\n }\n\n return { groups, leadingResponses };\n};\n","import { Button, Flex, useSlotRecipe } from \"@chakra-ui/react\";\nimport type { ReactNode } from \"react\";\nimport { ChatMessage } from \"./ai-message\";\nimport { messageFadeInProps } from \"./chat-message-animation\";\nimport { MessageActionPanel } from \"./message-action-panel\";\nimport { MessagePartsRenderer } from \"./message-parts-renderer\";\nimport { getMessageOrigin, type SessionMessage } from \"./message-types\";\n\ninterface ChatMessageListResponseProps {\n message: SessionMessage;\n streaming: boolean;\n hideQuestionForms?: boolean;\n animate?: boolean;\n showAssistantActions: boolean;\n}\n\nexport const ChatMessageListResponse = (props: ChatMessageListResponseProps) => {\n const { message, streaming, hideQuestionForms = false, animate = false, showAssistantActions } = props;\n const from = getMessageOrigin(message.role);\n const showActions = from === \"user\" || (from === \"assistant\" && showAssistantActions);\n\n return (\n <ChatMessage.Root from={from} {...(animate ? messageFadeInProps : undefined)}>\n <ChatMessage.Content from={from}>\n <MessagePartsRenderer\n message={message}\n streaming={streaming && from === \"assistant\"}\n hideQuestionForms={hideQuestionForms}\n />\n {showActions ? (\n <MessageActionPanel message={message} alwaysVisible={from === \"user\"} copyAlwaysVisible={from !== \"user\"} />\n ) : null}\n </ChatMessage.Content>\n </ChatMessage.Root>\n );\n};\n\ninterface StickyMessageToggleProps {\n expanded: boolean;\n label: string;\n onClick: () => void;\n actionPanel?: ReactNode;\n}\n\nexport const StickyMessageToggle = (props: StickyMessageToggleProps) => {\n const { expanded, label, onClick, actionPanel } = props;\n const recipe = useSlotRecipe({ key: \"stickyUserMessage\" });\n const styles = recipe({ expanded });\n\n return (\n <Flex css={styles.footer}>\n {actionPanel}\n <Button size=\"2xs\" variant=\"outline\" pointerEvents=\"auto\" onClick={onClick}>\n {label}\n </Button>\n </Flex>\n );\n};\n","import { getAssistantMessageActionTargetId, type MessageGroup, type SessionMessage } from \"./message-types\";\n\nexport type ChatMessageRow = {\n key: string;\n message: SessionMessage;\n} & (\n | { type: \"user\"; endIndex: number }\n | { type: \"response\"; userIndex: number | null; showAssistantActions: boolean; isActiveTurn: boolean }\n);\n\nexport const buildChatMessageRows = (leadingResponses: SessionMessage[], groups: MessageGroup[]) => {\n const leadingActionId = getAssistantMessageActionTargetId(leadingResponses);\n const rows: ChatMessageRow[] = leadingResponses.map((message) => ({\n type: \"response\",\n key: message.id,\n message,\n userIndex: null,\n showAssistantActions: message.id === leadingActionId,\n isActiveTurn: groups.length === 0,\n }));\n for (const [groupIndex, group] of groups.entries()) {\n const userIndex = rows.length;\n const actionId = getAssistantMessageActionTargetId(group.responses);\n rows.push({\n type: \"user\",\n key: group.userMessage.id,\n message: group.userMessage,\n endIndex: userIndex + group.responses.length,\n });\n for (const message of group.responses) {\n rows.push({\n type: \"response\",\n key: message.id,\n message,\n userIndex,\n showAssistantActions: message.id === actionId,\n isActiveTurn: groupIndex === groups.length - 1,\n });\n }\n }\n return rows;\n};\n\nexport const getChatStickyRowIndex = (rows: ChatMessageRow[], index: number) => {\n const row = rows[index];\n return row?.type === \"user\" ? index : (row?.userIndex ?? null);\n};\n\nexport const hasChatRowGap = (rows: ChatMessageRow[], index: number) => {\n const next = rows[index + 1];\n return Boolean(next) && (next.type === \"user\" || getChatStickyRowIndex(rows, index) === null);\n};\n","const SCROLL_BOUNDARY_EPSILON = 1;\n\ninterface StickyUserMessageScrollElement {\n clientHeight: number;\n scrollHeight: number;\n scrollTop: number;\n}\n\nexport const shouldStopStickyUserMessageWheel = (element: StickyUserMessageScrollElement, deltaY: number) => {\n const maxScrollTop = Math.max(0, element.scrollHeight - element.clientHeight);\n\n if (deltaY === 0 || maxScrollTop <= SCROLL_BOUNDARY_EPSILON) return false;\n if (deltaY < 0) return element.scrollTop > SCROLL_BOUNDARY_EPSILON;\n\n return element.scrollTop < maxScrollTop - SCROLL_BOUNDARY_EPSILON;\n};\n","import { Box, useSlotRecipe } from \"@chakra-ui/react\";\nimport { useLayoutEffect, useRef, useState, type WheelEvent } from \"react\";\nimport { ScrollArea } from \"@/components/primitives/scroll-area\";\nimport { ChatMessage } from \"./ai-message\";\nimport { messageFadeInProps } from \"./chat-message-animation\";\nimport { StickyMessageToggle } from \"./chat-message-list-items\";\nimport { shouldStopStickyUserMessageWheel } from \"./chat-panel-sticky-user-message\";\nimport { MessageActionPanel } from \"./message-action-panel\";\nimport { MessagePartsRenderer } from \"./message-parts-renderer\";\nimport type { SessionMessage } from \"./message-types\";\n\ninterface StickyUserMessageProps {\n message: SessionMessage;\n expanded: boolean;\n animate: boolean;\n onToggle: (messageId: string) => void;\n}\n\nconst handleWheel = (event: WheelEvent<HTMLElement>) => {\n if (shouldStopStickyUserMessageWheel(event.currentTarget, event.deltaY)) event.stopPropagation();\n};\n\nexport function StickyUserMessage(props: StickyUserMessageProps) {\n const { message, expanded, animate, onToggle } = props;\n const viewportRef = useRef<HTMLDivElement>(null);\n const bodyRef = useRef<HTMLDivElement>(null);\n const previewRef = useRef<HTMLDivElement>(null);\n const [collapsible, setCollapsible] = useState(false);\n const isExpanded = collapsible && expanded;\n const recipe = useSlotRecipe({ key: \"stickyUserMessage\" });\n const styles = recipe({ expanded: isExpanded });\n const viewportProps = {\n css: styles.viewport,\n \"data-sticky-user-message-content\": isExpanded ? \"expanded\" : \"collapsed\",\n onWheel: isExpanded ? handleWheel : undefined,\n };\n\n useLayoutEffect(() => {\n const body = bodyRef.current!;\n const preview = previewRef.current!;\n const measure = () => {\n setCollapsible(body.getBoundingClientRect().height > preview.getBoundingClientRect().height + 1);\n };\n const observer = new ResizeObserver(measure);\n observer.observe(body);\n observer.observe(preview);\n measure();\n return () => observer.disconnect();\n }, []);\n\n useLayoutEffect(() => {\n if (!isExpanded) viewportRef.current!.scrollTop = 0;\n }, [isExpanded]);\n\n const actions = <MessageActionPanel message={message} alwaysVisible copyAlwaysVisible={false} />;\n return (\n <ChatMessage.Root from=\"user\" delivery={message.delivery ?? \"sent\"} {...(animate ? messageFadeInProps : undefined)}>\n <ChatMessage.Content from=\"user\" css={styles.root}>\n <Box ref={previewRef} css={styles.preview} aria-hidden=\"true\" />\n <ScrollArea viewportRef={viewportRef} showVerticalScrollbar={isExpanded} viewportProps={viewportProps}>\n <Box ref={bodyRef} css={styles.body}>\n <MessagePartsRenderer message={message} />\n </Box>\n </ScrollArea>\n {!collapsible ? <Box css={styles.actions}>{actions}</Box> : null}\n {collapsible ? (\n <StickyMessageToggle\n expanded={isExpanded}\n label={isExpanded ? \"Show less\" : \"Show more\"}\n onClick={() => onToggle(message.id)}\n actionPanel={actions}\n />\n ) : null}\n </ChatMessage.Content>\n </ChatMessage.Root>\n );\n}\n","import { useEffect, useLayoutEffect, useRef } from \"react\";\n\nconst TAIL_READY_STABLE_FRAME_COUNT = 3;\nconst TAIL_READY_FRAME_LIMIT = 20;\nconst TAIL_READY_PIXEL_EPSILON = 1;\n\ninterface TailLayoutSnapshot {\n scrollTop: number;\n totalSize: number;\n}\n\nconst isTailLayoutStable = (current: TailLayoutSnapshot, previous: TailLayoutSnapshot) =>\n Math.abs(current.scrollTop - previous.scrollTop) <= TAIL_READY_PIXEL_EPSILON &&\n Math.abs(current.totalSize - previous.totalSize) <= TAIL_READY_PIXEL_EPSILON;\n\n// A tail that fits in the viewport has no scroll position to settle, so it can show at once.\nconst tailFitsViewport = (scrollElement: HTMLElement | null, totalSize: number) =>\n Boolean(scrollElement) && Math.max(scrollElement!.scrollHeight, totalSize) <= scrollElement!.clientHeight;\n\nconst readTailLayoutSnapshot = (scrollElement: HTMLElement | null, totalSize: number): TailLayoutSnapshot => ({\n scrollTop: scrollElement?.scrollTop ?? 0,\n totalSize,\n});\n\nexport const useTailReady = (input: {\n itemCount: number;\n onReady?: () => void;\n scrollRef: { current: HTMLElement | null };\n totalSize: number;\n}) => {\n const { itemCount, onReady, scrollRef, totalSize } = input;\n const onReadyRef = useRef(onReady);\n\n useEffect(() => {\n onReadyRef.current = onReady;\n }, [onReady]);\n\n // Runs before paint, so a conversation that fits is never hidden for the frames a long one waits.\n useLayoutEffect(() => {\n if (\n itemCount === 0 ||\n typeof requestAnimationFrame === \"undefined\" ||\n tailFitsViewport(scrollRef.current, totalSize)\n ) {\n onReadyRef.current?.();\n return;\n }\n\n let frameId = 0;\n let checkedFrameCount = 0;\n let stableFrameCount = 0;\n let previousSnapshot: TailLayoutSnapshot | null = null;\n\n const waitForStableTail = () => {\n checkedFrameCount += 1;\n\n const nextSnapshot = readTailLayoutSnapshot(scrollRef.current, totalSize);\n stableFrameCount =\n previousSnapshot && isTailLayoutStable(nextSnapshot, previousSnapshot) ? stableFrameCount + 1 : 0;\n previousSnapshot = nextSnapshot;\n\n if (stableFrameCount >= TAIL_READY_STABLE_FRAME_COUNT || checkedFrameCount >= TAIL_READY_FRAME_LIMIT) {\n onReadyRef.current?.();\n return;\n }\n\n frameId = requestAnimationFrame(waitForStableTail);\n };\n\n frameId = requestAnimationFrame(waitForStableTail);\n\n return () => cancelAnimationFrame(frameId);\n }, [itemCount, scrollRef, totalSize]);\n};\n","import { Box } from \"@chakra-ui/react\";\nimport { defaultRangeExtractor } from \"@tanstack/react-virtual\";\nimport { useStickToBottomContext } from \"use-stick-to-bottom\";\nimport { useVirtualizer } from \"@/utils/use-virtualizer\";\nimport { useMessageAnimationKeys } from \"./chat-message-animation\";\nimport { ChatMessageListResponse } from \"./chat-message-list-items\";\nimport { buildChatMessageRows, getChatStickyRowIndex, hasChatRowGap } from \"./chat-message-rows\";\nimport type { MessageGroup, SessionMessage } from \"./message-types\";\nimport { StickyUserMessage } from \"./sticky-user-message\";\nimport { useTailReady } from \"./use-chat-tail-ready\";\n\ninterface ChatMessageListProps {\n leadingResponses: SessionMessage[];\n groups: MessageGroup[];\n streaming: boolean;\n hideActiveQuestionForms: boolean;\n expandedStickyMessageIds: Set<string>;\n onToggleStickyMessage: (messageId: string) => void;\n onReady?: () => void;\n}\n\nconst ESTIMATED_MESSAGE_HEIGHT = 360;\nconst VIRTUAL_LIST_OVERSCAN = 4;\nconst VIRTUAL_LIST_GAP = 8;\n\nexport const ChatMessageList = (props: ChatMessageListProps) => {\n const {\n leadingResponses,\n groups,\n streaming,\n hideActiveQuestionForms,\n expandedStickyMessageIds,\n onToggleStickyMessage,\n onReady,\n } = props;\n const { scrollRef } = useStickToBottomContext();\n const rows = buildChatMessageRows(leadingResponses, groups);\n const animatedKeys = useMessageAnimationKeys(rows.map((row) => row.key));\n const initialHeight = scrollRef.current?.clientHeight || 1;\n const gapCount = Math.max(leadingResponses.length + groups.length - 1, 0);\n const { virtualizer, virtualItems, totalSize, measurements } = useVirtualizer<HTMLDivElement, HTMLDivElement>({\n count: rows.length,\n getScrollElement: () => scrollRef.current as HTMLDivElement | null,\n estimateSize: (index) => ESTIMATED_MESSAGE_HEIGHT + (hasChatRowGap(rows, index) ? VIRTUAL_LIST_GAP : 0),\n getItemKey: (index) => rows[index].key,\n overscan: VIRTUAL_LIST_OVERSCAN,\n initialRect: { width: 0, height: initialHeight },\n initialOffset: () =>\n Math.max(rows.length * ESTIMATED_MESSAGE_HEIGHT + gapCount * VIRTUAL_LIST_GAP - initialHeight, 0),\n rangeExtractor: (range) => {\n const indexes = defaultRangeExtractor(range);\n const stickyIndex = getChatStickyRowIndex(rows, range.startIndex);\n if (stickyIndex !== null && !indexes.includes(stickyIndex)) indexes.unshift(stickyIndex);\n return indexes;\n },\n });\n\n useTailReady({ itemCount: rows.length, onReady, scrollRef, totalSize });\n\n return (\n <Box px=\"xs\">\n <Box position=\"relative\" width=\"100%\" style={{ height: totalSize }}>\n {virtualItems.map((virtualItem) => {\n const row = rows[virtualItem.index];\n if (row.type === \"user\") {\n const end =\n (measurements[row.endIndex]?.end ?? totalSize) -\n (hasChatRowGap(rows, row.endIndex) ? VIRTUAL_LIST_GAP : 0);\n return (\n <Box\n key={virtualItem.key}\n position=\"absolute\"\n left=\"0\"\n width=\"100%\"\n zIndex={1}\n pointerEvents=\"none\"\n style={{ top: virtualItem.start, height: Math.max(virtualItem.size, end - virtualItem.start) }}\n >\n {/* Native sticky layout follows every scroll frame, including within one response. */}\n <Box\n ref={virtualizer.measureElement}\n data-index={virtualItem.index}\n data-chat-message-list-item=\"user\"\n data-chat-message-id={row.key}\n position=\"sticky\"\n top=\"0\"\n pointerEvents=\"auto\"\n pb={hasChatRowGap(rows, virtualItem.index) ? \"xs\" : undefined}\n >\n <StickyUserMessage\n message={row.message}\n expanded={expandedStickyMessageIds.has(row.key)}\n animate={animatedKeys.has(row.key)}\n onToggle={onToggleStickyMessage}\n />\n </Box>\n </Box>\n );\n }\n return (\n <Box\n key={virtualItem.key}\n ref={virtualizer.measureElement}\n data-index={virtualItem.index}\n data-chat-message-list-item={row.type}\n data-chat-message-id={row.key}\n position=\"absolute\"\n left=\"0\"\n width=\"100%\"\n pb={hasChatRowGap(rows, virtualItem.index) ? \"xs\" : undefined}\n style={{ top: virtualItem.start }}\n >\n <ChatMessageListResponse\n message={row.message}\n streaming={streaming && row.isActiveTurn && row.showAssistantActions}\n hideQuestionForms={!row.isActiveTurn || hideActiveQuestionForms}\n animate={animatedKeys.has(row.key)}\n showAssistantActions={row.showAssistantActions}\n />\n </Box>\n );\n })}\n </Box>\n </Box>\n );\n};\n","import { useEffect, useState } from \"react\";\nimport type { PromptSelectionSnapshot } from \"../../rich-text/prompt-input/plugins/preserve-selection-plugin\";\nimport { createSerializedPromptState } from \"../utils/editor-state\";\nimport type { ChatInputQuestionResponse } from \"./chat-input-question-prompt\";\nimport type { QueuedFollowUp } from \"./message-types\";\n\ninterface QueuedFollowUpComposerInput {\n queuedFollowUps: QueuedFollowUp[];\n defaultValue: string;\n onChange?: (text: string) => void;\n onSubmit?: (\n text: string,\n attachments: string[],\n questionResponse?: ChatInputQuestionResponse,\n ) => void | Promise<void>;\n onUpdate?: (itemId: string, prompt: string) => void | Promise<void>;\n onCreate?: (itemId: string, prompt: string) => void | Promise<void>;\n onRestoreDraft?: (itemId: string) => void;\n canRestoreDraft?: boolean;\n disabled?: boolean;\n onSelect?: (item: QueuedFollowUp | null) => void;\n onDiscard?: (itemId: string) => void;\n}\n\nexport const useQueuedFollowUpComposer = (input: QueuedFollowUpComposerInput) => {\n const {\n queuedFollowUps,\n defaultValue,\n onChange,\n onSubmit,\n onUpdate,\n onCreate,\n onRestoreDraft,\n canRestoreDraft = false,\n disabled = false,\n onSelect,\n onDiscard,\n } = input;\n const [editingItem, setEditingItem] = useState<QueuedFollowUp | null>(null);\n const [edits, setEdits] = useState<Record<string, { text: string; state: string }>>({});\n const [draftState, setDraftState] = useState<{ text: string; state: string } | null>(null);\n const [focusSignal, setFocusSignal] = useState(0);\n const [selections, setSelections] = useState<Record<string, PromptSelectionSnapshot>>({});\n const [error, setError] = useState<string | null>(null);\n const [updating, setUpdating] = useState(false);\n const [recoveredItemId, setRecoveredItemId] = useState<string | null>(null);\n const [notice, setNotice] = useState<string | null>(null);\n const savedItem = queuedFollowUps.find((item) => item.id === editingItem?.id);\n const createNew = Boolean(editingItem && !savedItem);\n const stale = Boolean(\n editingItem && savedItem && editingItem.revision && editingItem.revision !== savedItem.revision,\n );\n const inputValue = editingItem ? (edits[editingItem.id]?.text ?? editingItem.prompt) : defaultValue;\n const savedDraftState = draftState?.text === defaultValue ? draftState.state : undefined;\n const editorState = editingItem ? edits[editingItem.id]?.state : savedDraftState;\n const select = (item: QueuedFollowUp | null) => {\n setEditingItem(item);\n setError(null);\n setNotice(null);\n onSelect?.(item);\n setFocusSignal((signal) => signal + 1);\n };\n useEffect(() => {\n if (!editingItem || savedItem || updating || disabled || recoveredItemId === editingItem.id) return;\n setRecoveredItemId(editingItem.id);\n if (!canRestoreDraft || !onChange || defaultValue.trim() || queuedFollowUps.length) return;\n // The host moves settings and files before the editor gives the draft its text.\n onRestoreDraft?.(editingItem.id);\n setDraftState({ text: inputValue, state: editorState ?? createSerializedPromptState(inputValue) });\n setSelections((current) => ({ ...current, draft: current[editingItem.id] }));\n onChange(inputValue);\n setEdits((current) => {\n const next = { ...current };\n delete next[editingItem.id];\n return next;\n });\n setEditingItem(null);\n setError(null);\n onSelect?.(null);\n setFocusSignal((signal) => signal + 1);\n setNotice(\"This request was sent. Your edit moved to the draft.\");\n }, [\n editingItem,\n savedItem,\n updating,\n disabled,\n recoveredItemId,\n canRestoreDraft,\n defaultValue,\n queuedFollowUps.length,\n onRestoreDraft,\n inputValue,\n editorState,\n onChange,\n onSelect,\n ]);\n const change = (text: string) => {\n if (!editingItem) {\n if (text !== defaultValue) setNotice(null);\n onChange?.(text);\n return;\n }\n setEdits((current) => ({ ...current, [editingItem.id]: { text, state: createSerializedPromptState(text) } }));\n };\n const changeState = (text: string, state: string) => {\n if (!editingItem) {\n setDraftState({ text, state });\n return;\n }\n setEdits((current) => ({ ...current, [editingItem.id]: { text, state } }));\n };\n const discard = () => {\n if (editingItem) {\n onDiscard?.(editingItem.id);\n setEdits((current) => {\n const next = { ...current };\n delete next[editingItem.id];\n return next;\n });\n }\n select(null);\n };\n const submit = async (text: string, attachments: string[], questionResponse?: ChatInputQuestionResponse) => {\n if (questionResponse) return onSubmit?.(text, attachments, questionResponse);\n if (!editingItem) return onSubmit?.(text, attachments);\n if (stale || updating) throw new Error(\"Select the saved request again before updating.\");\n setUpdating(true);\n try {\n if (createNew) {\n if (!onCreate) throw new Error(\"This conversation cannot create a new queue item.\");\n await onCreate(editingItem.id, text);\n } else await onUpdate?.(editingItem.id, text);\n setEdits((current) => {\n const next = { ...current };\n delete next[editingItem.id];\n return next;\n });\n select(null);\n } catch (failure) {\n setError(failure instanceof Error ? failure.message : \"Could not update. Your edit is kept.\");\n throw failure;\n } finally {\n setUpdating(false);\n }\n };\n const selectionKey = editingItem?.id ?? \"draft\";\n return {\n initialSelection: selections[selectionKey],\n changeSelection: (selection: PromptSelectionSnapshot) =>\n setSelections((current) => ({ ...current, [selectionKey]: selection })),\n draftValue: defaultValue,\n change,\n changeState,\n edit: (item: QueuedFollowUp) => {\n if (!updating) select(item);\n },\n selectDraft: () => {\n if (!updating) select(null);\n },\n discard,\n editingItem,\n editingItemId: editingItem?.id ?? null,\n focusSignal,\n inputValue,\n editorState,\n isEditing: Boolean(editingItem),\n submit,\n error,\n notice: notice ?? (createNew ? \"This request was sent. Create a new queue item to keep your edits.\" : null),\n createNew,\n updating,\n stale,\n dirtyItemIds: Object.keys(edits).filter(\n (id) => edits[id].text !== queuedFollowUps.find((item) => item.id === id)?.prompt,\n ),\n };\n};\n","import { Box, Button, Text } from \"@chakra-ui/react\";\nimport { createSerializedPromptState } from \"../utils/editor-state\";\nimport { ChatInput } from \"./chat-input\";\nimport type { ChatPanelComposerProps } from \"./chat-panel-composer\";\n\ninterface QueuedComposerInputProps extends ChatPanelComposerProps {\n editing: boolean;\n hasQueuedFollowUps: boolean;\n}\nexport const QueuedComposerInput = (props: QueuedComposerInputProps) => {\n const {\n conversationKey,\n recentUserMessages,\n actions,\n attachmentActions,\n attachedResources,\n attachmentList,\n chatInputAutoFocus,\n chatInputPlaceholder,\n chatInputQuestionPrompt,\n composerDecision,\n chatInputCommands,\n inputDisabled,\n submitDisabled,\n onAttachFiles,\n onAttachText,\n onClearAttachments,\n onInterrupt,\n queuedComposer,\n streaming,\n } = props;\n const { editing, hasQueuedFollowUps } = props;\n const actionLabel = queuedComposer.createNew ? \"Create new queue item\" : \"Update\";\n const updateLabel = queuedComposer.updating ? \"Saving…\" : actionLabel;\n return (\n <Box\n onKeyDown={(event) => {\n if (\n event.key !== \"Escape\" ||\n event.defaultPrevented ||\n event.nativeEvent.isComposing ||\n !editing ||\n inputDisabled ||\n queuedComposer.updating ||\n !event.currentTarget.contains(event.target as Node)\n )\n return;\n event.preventDefault();\n event.stopPropagation();\n queuedComposer.discard();\n }}\n >\n <ChatInput\n key={`${conversationKey ?? \"\"}:${queuedComposer.editingItemId ?? \"draft\"}`}\n recentUserMessages={recentUserMessages}\n placeholder={chatInputPlaceholder}\n defaultState={queuedComposer.editorState ?? createSerializedPromptState(queuedComposer.inputValue)}\n streaming={editing ? false : streaming}\n onSubmit={queuedComposer.submit}\n onInterrupt={editing ? undefined : onInterrupt}\n onAttachFiles={onAttachFiles}\n onAttachText={onAttachText}\n onChange={queuedComposer.change}\n onEditorStateChange={queuedComposer.changeState}\n initialSelection={queuedComposer.initialSelection}\n onSelectionChange={queuedComposer.changeSelection}\n actions={actions}\n submitActions={\n editing ? (\n <Button\n size=\"xs\"\n variant=\"ghost\"\n onClick={queuedComposer.discard}\n disabled={queuedComposer.updating || inputDisabled}\n >\n Cancel\n </Button>\n ) : null\n }\n attachmentActions={attachmentActions}\n attachedResources={attachedResources}\n onClearAttachments={onClearAttachments}\n attachmentList={attachmentList}\n isDisabled={inputDisabled || queuedComposer.updating}\n submitDisabled={submitDisabled || (editing && queuedComposer.stale)}\n attachedToTop={!editing && hasQueuedFollowUps}\n questionPrompt={chatInputQuestionPrompt}\n decision={composerDecision}\n autoFocus={chatInputAutoFocus}\n focusSignal={queuedComposer.focusSignal}\n submitTitle={editing ? actionLabel : undefined}\n submitLabel={editing ? updateLabel : undefined}\n retainTextUntilAcknowledged={editing}\n commands={chatInputCommands}\n />\n <QueuedComposerNotice queuedComposer={queuedComposer} editing={editing} />\n </Box>\n );\n};\n\nconst QueuedComposerNotice = (props: Pick<QueuedComposerInputProps, \"queuedComposer\" | \"editing\">) => {\n const { queuedComposer, editing } = props;\n const stale = editing && queuedComposer.stale;\n const notice =\n queuedComposer.error ??\n (stale\n ? \"This request changed. Your edit is kept; select the saved request again before updating.\"\n : queuedComposer.notice);\n if (!notice) return null;\n const failure = Boolean(queuedComposer.error || stale);\n return (\n <Text\n mt=\"2xs\"\n color={failure ? \"fg.error\" : \"fg.muted\"}\n textStyle=\"label/S/regular\"\n role={failure ? \"alert\" : \"status\"}\n aria-label=\"Queued edit notice\"\n >\n {notice}\n </Text>\n );\n};\n","import { Box, Text, useSlotRecipe } from \"@chakra-ui/react\";\nimport { type KeyboardCoordinateGetter, useDroppable } from \"@dnd-kit/core\";\nimport { ArrowUp } from \"lucide-react\";\nimport { queuedFollowUpRecipe } from \"@/theme/recipes/queued-follow-up\";\nimport type { QueuedFollowUp } from \"./message-types\";\n\nexport const queueKeyboardCoordinates = (\n event: KeyboardEvent,\n { context }: Parameters<KeyboardCoordinateGetter>[1],\n onTarget?: (id: string | number) => void,\n) => {\n const keys = [\"ArrowUp\", \"ArrowDown\", \"Home\", \"End\"];\n if (!keys.includes(event.code)) return undefined;\n event.preventDefault();\n const targets = context.droppableContainers\n .getEnabled()\n .sort((a, b) => Number(a.data.current?.order) - Number(b.data.current?.order));\n const index = targets.findIndex((target) => target.id === context.over?.id);\n let next = index + (event.code === \"ArrowUp\" ? -1 : 1);\n if (event.code === \"Home\") next = 0;\n if (event.code === \"End\") next = targets.length - 1;\n const target = targets[Math.max(0, Math.min(targets.length - 1, next))];\n const rect = target && context.droppableRects.get(target.id);\n if (!rect) return undefined;\n onTarget?.(target.id);\n return {\n x: rect.left + (rect.width - (context.collisionRect?.width ?? 0)) / 2,\n y: rect.top + (rect.height - (context.collisionRect?.height ?? 0)) / 2,\n };\n};\n\nexport const QueueDropZone = (props: { item: QueuedFollowUp; index: number; kind: \"before\" | \"combine\" | \"after\" }) => {\n const { item, index, kind } = props;\n const drop = useDroppable({\n id: `${item.id}:${kind}`,\n disabled: Boolean(item.sending || item.steeringDelivery),\n data: { item, kind, order: index * 3 + [\"before\", \"combine\", \"after\"].indexOf(kind) },\n });\n const position = {\n before: { top: \"0\", height: \"25%\" },\n combine: { top: \"25%\", height: \"50%\" },\n after: { bottom: \"0\", height: \"25%\" },\n }[kind];\n return <Box ref={drop.setNodeRef} position=\"absolute\" insetX=\"0\" pointerEvents=\"none\" {...position} />;\n};\n\nexport const QueueSendNow = (props: { visible: boolean; targeted: boolean; reason?: string | null }) => {\n const { visible, targeted, reason } = props;\n const drop = useDroppable({ id: \"queue-send-now\", disabled: !visible, data: { kind: \"steer\", order: -1 } });\n const styles = useSlotRecipe({ recipe: queuedFollowUpRecipe })();\n if (!visible) return null;\n return (\n <Box ref={drop.setNodeRef} css={styles.sendNowHit}>\n <Box\n css={styles.sendNow}\n bottom=\"0\"\n title={reason ?? undefined}\n aria-disabled={Boolean(reason)}\n data-targeted={targeted && !reason}\n data-queue-send-now\n >\n <ArrowUp size={14} />\n <Text>{\"drop here to send now\"}</Text>\n </Box>\n </Box>\n );\n};\n","import { Box, HStack, IconButton, Stack, Text, useSlotRecipe } from \"@chakra-ui/react\";\nimport { useDraggable } from \"@dnd-kit/core\";\nimport { GripVertical, Trash2 } from \"lucide-react\";\nimport { type ReactNode, useEffect, useRef, useState } from \"react\";\nimport { DropIndicator } from \"@/components/primitives/drop-indicator\";\nimport { queuedFollowUpRecipe } from \"@/theme/recipes/queued-follow-up\";\nimport type { QueuedFollowUp } from \"./message-types\";\nimport { QueueDropZone } from \"./queued-follow-up-drag\";\n\ninterface QueuedFollowUpRowProps {\n item: QueuedFollowUp;\n index: number;\n editor?: ReactNode;\n source: boolean;\n destination?: string;\n unavailableReason?: string | null;\n editing: boolean;\n onEdit?: (item: QueuedFollowUp) => void;\n onRemove?: (id: string) => void;\n}\nexport const QueuedFollowUpRow = (props: QueuedFollowUpRowProps) => {\n const { item, index, editor, source, destination, unavailableReason, editing, onEdit, onRemove } = props;\n const disabled = Boolean(item.sending || item.steeringDelivery);\n const drag = useDraggable({ id: item.id, data: { item }, disabled });\n const styles = useSlotRecipe({ recipe: queuedFollowUpRecipe })();\n const [hovered, setHovered] = useState(false);\n const [focused, setFocused] = useState(false);\n const exit = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const row = useRef<HTMLDivElement | null>(null);\n useEffect(() => () => clearTimeout(exit.current), []);\n useEffect(() => {\n if (editing) row.current?.scrollIntoView({ block: \"nearest\" });\n }, [editing]);\n const reveal = () => {\n clearTimeout(exit.current);\n setHovered(true);\n };\n const compact = !editor;\n return (\n <Box\n className=\"group\"\n ref={(node: HTMLDivElement | null) => {\n drag.setNodeRef(node);\n row.current = node;\n }}\n css={styles.row}\n data-drag-source={source}\n data-combine-target={destination === \"combine\" && !unavailableReason}\n data-queued-follow-up-id={item.id}\n aria-busy={item.sending || undefined}\n onPointerEnter={reveal}\n onPointerLeave={() => {\n exit.current = setTimeout(() => setHovered(false), 150);\n }}\n onPointerDown={(event) => {\n if (event.pointerType === \"touch\") reveal();\n }}\n onFocusCapture={() => setFocused(true)}\n onBlurCapture={(event) => {\n if (!event.currentTarget.contains(event.relatedTarget)) setFocused(false);\n }}\n onClick={(event) => {\n if (!item.sending && compact && !(event.target as Element).closest(\"button\")) onEdit?.(item);\n }}\n >\n <IconButton\n ref={drag.setActivatorNodeRef}\n {...drag.listeners}\n {...drag.attributes}\n aria-label={`Drag queued follow-up ${index + 1}`}\n size=\"2xs\"\n variant=\"ghost\"\n css={styles.handle}\n disabled={disabled}\n onClick={(event) => event.stopPropagation()}\n >\n <GripVertical size={14} />\n </IconButton>\n <Stack flex=\"1\" minW=\"0\" gap=\"2xs\">\n {editor ?? (\n <Box asChild css={styles.content}>\n <button\n type=\"button\"\n disabled={item.sending}\n aria-label={`Edit queued message: ${item.prompt}`}\n onClick={() => onEdit?.(item)}\n >\n <Text lineClamp={2}>{item.prompt}</Text>\n <Text color=\"fg.muted\" textStyle=\"label/XS\" lineClamp={1}>\n {destination === \"combine\"\n ? (unavailableReason ?? \"Release to combine\")\n : [\n item.sending ? \"Sending…\" : null,\n item.model,\n ...Object.values(item.params ?? {}).map(String),\n ...(item.attachments?.map((attachment) => attachment.name) ?? []),\n ]\n .filter(Boolean)\n .join(\" · \") || \"Saved request\"}\n </Text>\n </button>\n </Box>\n )}\n {item.steeringDelivery ? (\n <Text css={styles.notice}>Delivery is unconfirmed. Saved input is kept and will not be replayed.</Text>\n ) : null}\n </Stack>\n {onRemove && !editor && !disabled ? (\n <HStack css={styles.actions} data-visible={hovered || focused || editing}>\n <IconButton\n aria-label=\"Remove queued follow-up\"\n size=\"2xs\"\n variant=\"destructive-ghost\"\n onClick={(event) => {\n event.stopPropagation();\n onRemove(item.id);\n }}\n >\n <Trash2 size={14} />\n </IconButton>\n </HStack>\n ) : null}\n <QueueDropZone item={item} index={index} kind=\"before\" />\n <QueueDropZone item={item} index={index} kind=\"combine\" />\n <QueueDropZone item={item} index={index} kind=\"after\" />\n {destination === \"before\" ? <DropIndicator top=\"0\" /> : null}\n {destination === \"after\" ? <DropIndicator bottom=\"0\" /> : null}\n </Box>\n );\n};\n","import { Box, Text, useSlotRecipe } from \"@chakra-ui/react\";\nimport {\n DndContext,\n KeyboardSensor,\n PointerSensor,\n pointerWithin,\n rectIntersection,\n useSensor,\n useSensors,\n} from \"@dnd-kit/core\";\nimport { Fragment, type ReactNode, useState } from \"react\";\nimport { ScrollArea } from \"@/components/primitives/scroll-area\";\nimport { queuedFollowUpRecipe } from \"@/theme/recipes/queued-follow-up\";\nimport type { QueuedFollowUp } from \"./message-types\";\nimport { QueueSendNow, queueKeyboardCoordinates } from \"./queued-follow-up-drag\";\nimport type { QueuedFollowUpMoveDirection } from \"./queued-follow-up-list-state\";\nimport { QueuedFollowUpRow } from \"./queued-follow-up-row\";\n\ninterface QueuedFollowUpListProps {\n items: QueuedFollowUp[];\n editingItemId?: string | null;\n editor?: ReactNode;\n retainedEditor?: ReactNode;\n retainedEditorPosition?: number;\n dirtyItemIds?: string[];\n steeringUnavailableReason?: string | null;\n onEdit?: (item: QueuedFollowUp) => void;\n onRemove?: (itemId: string) => void;\n onMove?: (\n itemId: string,\n direction: QueuedFollowUpMoveDirection,\n steps?: number,\n selection?: { source: QueuedFollowUp; items: QueuedFollowUp[] },\n ) => void | Promise<void>;\n onSteer?: (item: QueuedFollowUp) => void | Promise<void>;\n onCombine?: (source: QueuedFollowUp, target: QueuedFollowUp) => void | Promise<void>;\n}\nconst settingsKey = (item: QueuedFollowUp) =>\n JSON.stringify([item.model, Object.entries(item.params ?? {}).sort(([a], [b]) => a.localeCompare(b))]);\nexport const QueuedFollowUpList = (props: QueuedFollowUpListProps) => {\n const {\n items,\n editingItemId,\n editor,\n retainedEditor,\n retainedEditorPosition,\n dirtyItemIds = [],\n steeringUnavailableReason,\n onEdit,\n onRemove,\n onMove,\n onSteer,\n onCombine,\n } = props;\n const styles = useSlotRecipe({ recipe: queuedFollowUpRecipe })();\n const [keyboardTarget, setKeyboardTarget] = useState<string | number | null>(null);\n const sensors = useSensors(\n useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),\n useSensor(KeyboardSensor, {\n coordinateGetter: (event, context) => queueKeyboardCoordinates(event, context, setKeyboardTarget),\n }),\n );\n const [source, setSource] = useState<QueuedFollowUp | null>(null);\n const [dragItems, setDragItems] = useState<QueuedFollowUp[]>([]);\n const [destination, setDestination] = useState<{ kind: string; item?: QueuedFollowUp } | null>(null);\n const [error, setError] = useState<string | null>(null);\n const [pending, setPending] = useState(false);\n if (!items.length && !retainedEditor) return null;\n const retainedIndex = getRetainedEditorIndex(items, retainedEditorPosition);\n const steerReason =\n source?.steeringUnavailableReason ??\n steeringUnavailableReason ??\n (source && dirtyItemIds.includes(source.id) ? \"Update or Cancel this edit before sending.\" : null) ??\n (onSteer ? null : \"This conversation cannot accept live input.\");\n const showSendNow = Boolean(source && onSteer && !steeringUnavailableReason);\n const combineReason = (target: QueuedFollowUp) => {\n if (!source || source.id === target.id) return \"Choose another request.\";\n if (dirtyItemIds.includes(source.id) || dirtyItemIds.includes(target.id))\n return \"Update or Cancel the edits first.\";\n if (settingsKey(source) !== settingsKey(target)) return \"Model and thinking settings must match.\";\n if (target.steeringDelivery) return \"Delivery is still being confirmed.\";\n return null;\n };\n const reorder = (selected: QueuedFollowUp, target: QueuedFollowUp, kind: string) => {\n const eligible = dragItems.filter((item) => !item.sending && !item.steeringDelivery);\n const start = eligible.findIndex((item) => item.id === selected.id);\n const end = eligible.findIndex((item) => item.id === target.id);\n if (start < 0 || end < 0 || start === end) return;\n const insertion = end + (kind === \"after\" ? 1 : 0);\n const next = insertion - (start < insertion ? 1 : 0);\n if (next === start) return;\n return onMove?.(selected.id, next < start ? \"up\" : \"down\", Math.abs(next - start), {\n source: selected,\n items: dragItems,\n });\n };\n const performDrop = (selected: QueuedFollowUp, target: { kind: string; item?: QueuedFollowUp }) => {\n if (target.kind === \"steer\") {\n if (!steerReason) return onSteer?.(selected);\n setError(steerReason);\n return;\n }\n if (!target.item) return;\n if (target.kind === \"combine\") {\n if (!combineReason(target.item)) return onCombine?.(selected, target.item);\n return;\n }\n return reorder(selected, target.item, target.kind);\n };\n return (\n <DndContext\n sensors={sensors}\n collisionDetection={(args) => {\n if (!args.pointerCoordinates && keyboardTarget !== null) return [{ id: keyboardTarget }];\n const pointer = pointerWithin(args);\n return pointer.length ? pointer : rectIntersection(args);\n }}\n autoScroll\n onDragStart={(event) => {\n setKeyboardTarget(null);\n setSource(event.active.data.current?.item ?? null);\n setDragItems(items);\n setError(null);\n }}\n onDragOver={(event) =>\n setDestination((event.over?.data.current as { kind: string; item?: QueuedFollowUp }) ?? null)\n }\n onDragCancel={() => {\n setKeyboardTarget(null);\n setSource(null);\n setDestination(null);\n }}\n onDragEnd={(event) => {\n const selected = source;\n const target = event.over?.data.current;\n setSource(null);\n setDestination(null);\n if (!selected || !target || pending) return;\n setPending(true);\n void Promise.resolve()\n .then(() => performDrop(selected, target as { kind: string; item?: QueuedFollowUp }))\n .catch((failure) =>\n setError(failure instanceof Error ? failure.message : \"Could not change the queue. Saved input is kept.\"),\n )\n .finally(() => setPending(false));\n }}\n >\n <Box css={styles.root} data-send-now-visible={showSendNow} aria-busy={pending}>\n <QueueSendNow visible={showSendNow} targeted={destination?.kind === \"steer\"} reason={steerReason} />\n <ScrollArea maxH=\"queue-viewport\" minH=\"0\" viewportProps={{ maxH: \"queue-viewport\" }}>\n {items.map((item, index) => (\n <Fragment key={item.id}>\n {retainedEditor && index === retainedIndex ? <RetainedEditor>{retainedEditor}</RetainedEditor> : null}\n <QueuedFollowUpRow\n item={item}\n index={index}\n source={source?.id === item.id}\n destination={destination?.item?.id === item.id ? destination.kind : undefined}\n unavailableReason={destination?.kind === \"combine\" ? combineReason(item) : null}\n editing={editingItemId === item.id}\n editor={editingItemId === item.id ? editor : undefined}\n onEdit={onEdit}\n onRemove={onRemove}\n />\n </Fragment>\n ))}\n {retainedEditor && retainedIndex === items.length ? <RetainedEditor>{retainedEditor}</RetainedEditor> : null}\n </ScrollArea>\n {error ? (\n <Text css={styles.notice} role=\"alert\">\n {error}\n </Text>\n ) : null}\n </Box>\n </DndContext>\n );\n};\n\nconst getRetainedEditorIndex = (items: QueuedFollowUp[], position = Number.POSITIVE_INFINITY) => {\n const index = items.findIndex((item) => (item.position ?? Number.POSITIVE_INFINITY) > position);\n return index < 0 ? items.length : index;\n};\n\nconst RetainedEditor = (props: { children: ReactNode }) => {\n const { children } = props;\n const styles = useSlotRecipe({ recipe: queuedFollowUpRecipe })();\n return (\n <Box css={styles.row}>\n <Box flex=\"1\" minW=\"0\">\n {children}\n </Box>\n </Box>\n );\n};\n","import { Box, Stack, useSlotRecipe } from \"@chakra-ui/react\";\nimport type { ReactNode } from \"react\";\nimport { chatComposerRecipe } from \"@/theme/recipes/chat-composer\";\nimport { queuedFollowUpRecipe } from \"@/theme/recipes/queued-follow-up\";\nimport type { useQueuedFollowUpComposer } from \"./use-queued-follow-up-composer\";\n\nexport { useQueuedFollowUpComposer } from \"./use-queued-follow-up-composer\";\n\nimport type { PromptCommand } from \"@/components/rich-text\";\nimport type { ChatInputQuestionPrompt } from \"./chat-input-question-prompt\";\nimport type { ComposerDecision } from \"./composer-decision\";\nimport type { QueuedFollowUp } from \"./message-types\";\nimport { QueuedComposerInput } from \"./queued-composer-input\";\nimport { QueuedFollowUpList } from \"./queued-follow-up-list\";\nimport type { QueuedFollowUpMoveDirection } from \"./queued-follow-up-list-state\";\n\nexport interface ChatPanelComposerProps {\n conversationKey?: string;\n recentUserMessages: string[];\n actions?: ReactNode;\n /** Attachment controls shown only while editing a message draft. */\n attachmentActions?: ReactNode;\n composerHeader?: ReactNode;\n attachedResources?: string[];\n attachmentList?: ReactNode;\n chatInputAutoFocus: boolean;\n chatInputPlaceholder: string;\n chatInputQuestionPrompt?: ChatInputQuestionPrompt;\n composerDecision?: ComposerDecision;\n chatInputCommands: PromptCommand[];\n hasWorkspaceHub: boolean;\n inputDisabled: boolean;\n submitDisabled: boolean;\n onAttachFiles?: (files: File[]) => void;\n onAttachText?: (text: string) => void;\n onClearAttachments?: () => void;\n onInterrupt?: () => void;\n onQueuedFollowUpMove?: (\n itemId: string,\n direction: QueuedFollowUpMoveDirection,\n steps?: number,\n selection?: { source: QueuedFollowUp; items: QueuedFollowUp[] },\n ) => void;\n onQueuedFollowUpRemove?: (itemId: string) => void;\n onQueuedFollowUpUpdate?: (itemId: string, prompt: string) => void | Promise<void>;\n onQueuedFollowUpSteer?: (item: QueuedFollowUp) => void | Promise<void>;\n onQueuedFollowUpCombine?: (source: QueuedFollowUp, target: QueuedFollowUp) => void | Promise<void>;\n queueSteeringUnavailableReason?: string | null;\n unsavedQueueItemIds?: string[];\n queuedComposer: ReturnType<typeof useQueuedFollowUpComposer>;\n queuedFollowUps: QueuedFollowUp[];\n streaming: boolean;\n workspaceHub?: ReactNode;\n}\n\nexport const ChatPanelComposer = (props: ChatPanelComposerProps) => {\n const {\n composerHeader,\n chatInputQuestionPrompt,\n composerDecision,\n hasWorkspaceHub,\n onQueuedFollowUpMove,\n onQueuedFollowUpRemove,\n onQueuedFollowUpUpdate,\n onQueuedFollowUpSteer,\n onQueuedFollowUpCombine,\n queueSteeringUnavailableReason,\n unsavedQueueItemIds = [],\n queuedComposer,\n queuedFollowUps,\n workspaceHub,\n } = props;\n const styles = useSlotRecipe({ recipe: queuedFollowUpRecipe })();\n const composerStyles = useSlotRecipe({ recipe: chatComposerRecipe })({ workspace: hasWorkspaceHub });\n const hasQueuedFollowUps = queuedFollowUps.length > 0;\n\n const editing = queuedComposer.isEditing && !chatInputQuestionPrompt && !composerDecision;\n const editor = <QueuedComposerInput {...props} editing={editing} hasQueuedFollowUps={hasQueuedFollowUps} />;\n return (\n <Stack p=\"xs\" gap=\"0\">\n <Box className=\"ps-chat-composer__workspace\" css={composerStyles.workspace}>\n {workspaceHub}\n {composerHeader}\n <QueuedFollowUpList\n items={queuedFollowUps}\n editor={editing ? editor : undefined}\n retainedEditor={editing && queuedComposer.createNew ? editor : undefined}\n retainedEditorPosition={queuedComposer.editingItem?.position}\n dirtyItemIds={[...queuedComposer.dirtyItemIds, ...unsavedQueueItemIds]}\n steeringUnavailableReason={queueSteeringUnavailableReason}\n onSteer={onQueuedFollowUpSteer}\n onCombine={onQueuedFollowUpCombine}\n editingItemId={queuedComposer.editingItemId}\n onEdit={onQueuedFollowUpUpdate ? queuedComposer.edit : undefined}\n onRemove={onQueuedFollowUpRemove}\n onMove={onQueuedFollowUpMove}\n />\n {editing ? (\n <Box css={styles.draft} asChild>\n <button type=\"button\" onClick={queuedComposer.selectDraft} aria-label=\"Edit saved draft\">\n {queuedComposer.draftValue || \"Saved draft · select to edit\"}\n </button>\n </Box>\n ) : (\n editor\n )}\n </Box>\n </Stack>\n );\n};\n","import { HStack, Spinner, Text } from \"@chakra-ui/react\";\nimport { useEffect, useState } from \"react\";\n\n// Compact, unit-dropping elapsed format: \"4s\", \"48s\", \"10m 20s\", \"1h 04m\".\nconst formatElapsed = (totalSeconds: number) => {\n const seconds = Math.max(0, Math.floor(totalSeconds));\n if (seconds < 60) return `${seconds}s`;\n\n const minutes = Math.floor(seconds / 60);\n if (minutes < 60) return `${minutes}m ${String(seconds % 60).padStart(2, \"0\")}s`;\n\n const hours = Math.floor(minutes / 60);\n return `${hours}h ${String(minutes % 60).padStart(2, \"0\")}m`;\n};\n\n/**\n * Working indicator: a spinner followed by the elapsed run time in mono digits — never a\n * static \"Working…\" label. The elapsed time is the one thing a static label cannot tell you\n * and how you judge whether a run is stuck. Counts from the start of the active stream, including\n * time spent temporarily hidden while the workspace initializes.\n */\nexport const WorkingIndicator = (props: { startedAt?: number; hidden?: boolean }) => {\n const { startedAt, hidden = false } = props;\n const [mountedAt] = useState(Date.now);\n const [now, setNow] = useState(Date.now);\n\n useEffect(() => {\n if (hidden) return;\n\n const updateElapsed = () => setNow(Date.now());\n updateElapsed();\n const timer = setInterval(updateElapsed, 1000);\n return () => clearInterval(timer);\n }, [hidden]);\n\n if (hidden) return null;\n\n return (\n <HStack gap=\"2xs\" px=\"sm\" py=\"xs\">\n <Spinner size=\"xs\" color=\"fg.muted\" />\n <Text fontFamily=\"mono\" fontSize=\"xs\" color=\"fg.muted\" letterSpacing=\"-0.2px\">\n {formatElapsed((now - (startedAt ?? mountedAt)) / 1000)}\n </Text>\n </HStack>\n );\n};\n","import { Box, Flex } from \"@chakra-ui/react\";\nimport { MessageCircleIcon } from \"lucide-react\";\nimport { type ReactNode, useState } from \"react\";\nimport { EmptyState } from \"@/components/primitives/empty-state\";\nimport type { PromptCommand } from \"@/components/rich-text\";\nimport { ChatImageHistoryContext, indexChatImageSources } from \"../links/chat-image-sources\";\nimport type { ChatLinkProps } from \"../links/chat-link\";\nimport { ChatLinkProvider } from \"../links/chat-link-context\";\nimport { resolveActiveQuestionPrompt } from \"../tool-rendering/question-prompt\";\nimport { ChatPrimitives } from \"./ai-conversation\";\nimport { AutoScroll } from \"./auto-scroll\";\nimport { getRecentUserPrompts } from \"./chat-input-history\";\nimport type { ChatInputQuestionPrompt, ChatInputQuestionResponse } from \"./chat-input-question-prompt\";\nimport { ChatMessageList } from \"./chat-message-list\";\nimport { ChatPanelComposer, useQueuedFollowUpComposer } from \"./chat-panel-composer\";\nimport { ChatQuestionNavigationContext, useChatQuestionNavigation } from \"./chat-question-navigation\";\nimport type { ComposerDecision } from \"./composer-decision\";\nimport {\n groupMessagesByTurn,\n normalizeChatMessagesForDisplay,\n type QueuedFollowUp,\n type SessionMessage,\n} from \"./message-types\";\nimport type { QueuedFollowUpMoveDirection } from \"./queued-follow-up-list-state\";\nimport { WorkingIndicator } from \"./working-indicator\";\n\n/** Full conversation shell for agent sessions, including messages, input, attachments, and host-provided slots. */\nexport interface ChatPanelProps extends ChatLinkProps {\n /** Stable conversation identity used to reset ready state when switching sessions. */\n conversationKey?: string;\n messages: SessionMessage[];\n loading?: boolean;\n streaming?: boolean;\n /** Current run start in milliseconds. Without an anchor, elapsed time starts when streaming mounts. */\n streamingStartedAt?: number;\n emptyStateTitle: string;\n emptyStateDescription: string;\n emptyStateContent?: ReactNode;\n loaderComponent?: ReactNode;\n chatInputPlaceholder: string;\n chatInputDefaultValue?: string;\n onSubmitMessage?: (\n text: string,\n attachments: string[],\n questionResponse?: ChatInputQuestionResponse,\n ) => void | Promise<void>;\n onInterrupt?: () => void;\n onAttachFiles?: (files: File[]) => void;\n onAttachText?: (text: string) => void;\n onChatInputChange?: (text: string) => void;\n /** Controls shared by the message and question toolbars (model, params). */\n actions?: ReactNode;\n /** Attachment controls shown only while editing a message draft. */\n attachmentActions?: ReactNode;\n composerHeader?: ReactNode;\n attachedResources?: string[];\n onClearAttachments?: () => void;\n attachmentList?: ReactNode;\n approvalPrompt?: ReactNode;\n /** Problems shown at the end of the conversation, such as a failed load or a message that was not sent. Without messages, they appear above the empty state. */\n conversationNotices?: ReactNode;\n /** Optional workspace status/control surface rendered above the conversation viewport. */\n workspaceHub?: ReactNode;\n workspaceInitializing?: boolean;\n inputDisabled?: boolean;\n /** Blocks sending while the editor stays usable, for example while no model is selected. */\n submitDisabled?: boolean;\n chatInputQuestionPrompt?: ChatInputQuestionPrompt;\n composerDecision?: ComposerDecision;\n chatInputAutoFocus?: boolean;\n queuedFollowUps?: QueuedFollowUp[];\n onQueuedFollowUpUpdate?: (itemId: string, prompt: string) => void | Promise<void>;\n /** Submit the retained edit's settings and files as a new request. */\n onQueuedFollowUpCreate?: (itemId: string, prompt: string) => void | Promise<void>;\n /** Move the retained edit's settings and files into the normal draft before its text changes. */\n onQueuedFollowUpRestoreDraft?: (itemId: string) => void;\n /** Allow recovery only when the normal draft has no files or uploads and the host can transfer the edit. */\n canRestoreQueuedEditToDraft?: boolean;\n onQueuedFollowUpSelect?: (item: QueuedFollowUp | null) => void;\n onQueuedFollowUpDiscard?: (itemId: string) => void;\n onQueuedFollowUpSteer?: (item: QueuedFollowUp) => void | Promise<void>;\n onQueuedFollowUpCombine?: (source: QueuedFollowUp, target: QueuedFollowUp) => void | Promise<void>;\n queueSteeringUnavailableReason?: string | null;\n unsavedQueueItemIds?: string[];\n\n onQueuedFollowUpRemove?: (itemId: string) => void;\n onQueuedFollowUpMove?: (\n itemId: string,\n direction: QueuedFollowUpMoveDirection,\n steps?: number,\n selection?: { source: QueuedFollowUp; items: QueuedFollowUp[] },\n ) => void;\n chatInputCommands?: PromptCommand[];\n}\n\nexport const ChatPanel = (props: ChatPanelProps) => {\n const {\n conversationKey,\n linkHandler,\n messages,\n loading = false,\n streaming = false,\n streamingStartedAt,\n emptyStateTitle,\n emptyStateDescription,\n emptyStateContent,\n loaderComponent,\n chatInputPlaceholder,\n chatInputDefaultValue = \"\",\n onSubmitMessage,\n onInterrupt,\n onAttachFiles,\n onAttachText,\n onChatInputChange,\n actions,\n attachmentActions,\n composerHeader,\n attachedResources,\n onClearAttachments,\n attachmentList,\n approvalPrompt,\n conversationNotices,\n workspaceHub,\n workspaceInitializing = false,\n inputDisabled = false,\n submitDisabled = false,\n chatInputQuestionPrompt,\n composerDecision,\n chatInputAutoFocus = false,\n queuedFollowUps = [],\n onQueuedFollowUpUpdate,\n onQueuedFollowUpCreate,\n onQueuedFollowUpRestoreDraft,\n canRestoreQueuedEditToDraft,\n onQueuedFollowUpSelect,\n onQueuedFollowUpDiscard,\n onQueuedFollowUpSteer,\n onQueuedFollowUpCombine,\n queueSteeringUnavailableReason,\n unsavedQueueItemIds,\n onQueuedFollowUpRemove,\n onQueuedFollowUpMove,\n chatInputCommands = [],\n } = props;\n\n const merged = normalizeChatMessagesForDisplay(messages, { streaming });\n const hasMessages = merged.length > 0;\n const messageListKey = conversationKey ?? merged[0]?.id;\n const messageListIdentity = hasMessages ? (messageListKey ?? \"active-conversation\") : null;\n const userMessageCount = merged.reduce((count, message) => count + (message.role === \"user\" ? 1 : 0), 0);\n const { groups, leadingResponses } = groupMessagesByTurn(merged);\n const [expandedStickyMessageIds, setExpandedStickyMessageIds] = useState(() => new Set<string>());\n const [readyMessageListKey, setReadyMessageListKey] = useState<string | null>(null);\n const showLoadingState = !hasMessages && loading;\n const defaultEmptyContent = (\n <EmptyState\n icon={<MessageCircleIcon size={48} strokeWidth={1.5} />}\n title={emptyStateTitle}\n description={emptyStateDescription}\n />\n );\n const emptyContent = showLoadingState ? loaderComponent : (emptyStateContent ?? defaultEmptyContent);\n const hasWorkspaceHub = Boolean(workspaceHub);\n const questionNavigation = useChatQuestionNavigation(messages, conversationKey ?? messages[0]?.id);\n const activeQuestionPrompt =\n questionNavigation.prompt ?? chatInputQuestionPrompt ?? resolveActiveQuestionPrompt(messages);\n const hideActiveQuestionForms = Boolean(activeQuestionPrompt);\n const showThinkingIndicator = streaming && hasMessages && !workspaceInitializing && !activeQuestionPrompt;\n const isMessageViewportReady = !messageListIdentity || readyMessageListKey === messageListIdentity;\n const queuedComposer = useQueuedFollowUpComposer({\n queuedFollowUps,\n defaultValue: chatInputDefaultValue,\n onChange: onChatInputChange,\n onSubmit: onSubmitMessage,\n onUpdate: onQueuedFollowUpUpdate,\n onCreate: onQueuedFollowUpCreate,\n onRestoreDraft: onQueuedFollowUpRestoreDraft,\n canRestoreDraft: canRestoreQueuedEditToDraft,\n disabled: inputDisabled,\n onSelect: onQueuedFollowUpSelect,\n onDiscard: onQueuedFollowUpDiscard,\n });\n\n const toggleStickyMessageExpanded = (messageId: string) => {\n setExpandedStickyMessageIds((current) => {\n const next = new Set(current);\n if (next.has(messageId)) {\n next.delete(messageId);\n } else {\n next.add(messageId);\n }\n\n return next;\n });\n };\n\n return (\n <ChatImageHistoryContext value={indexChatImageSources(messages, linkHandler)}>\n <ChatLinkProvider handler={linkHandler}>\n <ChatQuestionNavigationContext value={questionNavigation.value}>\n <Flex position=\"relative\" direction=\"column\" w=\"full\" h=\"full\" overflow=\"hidden\">\n <ChatPrimitives.Root key={messageListKey}>\n <AutoScroll conversationKey={messageListKey ?? null} userMessageCount={userMessageCount} />\n <ChatPrimitives.Viewport visibility={isMessageViewportReady ? \"visible\" : \"hidden\"}>\n {hasMessages ? (\n <>\n <ChatMessageList\n key={messageListIdentity}\n leadingResponses={leadingResponses}\n groups={groups}\n streaming={streaming}\n hideActiveQuestionForms={hideActiveQuestionForms}\n expandedStickyMessageIds={expandedStickyMessageIds}\n onToggleStickyMessage={toggleStickyMessageExpanded}\n onReady={() => setReadyMessageListKey(messageListIdentity)}\n />\n {conversationNotices}\n </>\n ) : (\n <>\n {conversationNotices}\n {emptyContent}\n </>\n )}\n </ChatPrimitives.Viewport>\n {isMessageViewportReady ? <ChatPrimitives.ScrollToBottom aria-label=\"Scroll to latest message\" /> : null}\n </ChatPrimitives.Root>\n <Box layerStyle=\"chatContent\" flexShrink=\"0\">\n {approvalPrompt}\n {streaming ? (\n <WorkingIndicator key={messageListKey} startedAt={streamingStartedAt} hidden={!showThinkingIndicator} />\n ) : null}\n <ChatPanelComposer\n conversationKey={conversationKey ?? messages[0]?.id}\n recentUserMessages={getRecentUserPrompts(messages)}\n actions={actions}\n attachmentActions={attachmentActions}\n composerHeader={composerHeader}\n attachedResources={attachedResources}\n attachmentList={attachmentList}\n chatInputAutoFocus={chatInputAutoFocus}\n chatInputPlaceholder={chatInputPlaceholder}\n chatInputQuestionPrompt={activeQuestionPrompt}\n composerDecision={questionNavigation.prompt ? undefined : composerDecision}\n chatInputCommands={chatInputCommands}\n hasWorkspaceHub={hasWorkspaceHub}\n inputDisabled={inputDisabled}\n submitDisabled={submitDisabled}\n onAttachFiles={onAttachFiles}\n onAttachText={onAttachText}\n onClearAttachments={onClearAttachments}\n onInterrupt={onInterrupt}\n onQueuedFollowUpMove={onQueuedFollowUpMove}\n onQueuedFollowUpRemove={onQueuedFollowUpRemove}\n onQueuedFollowUpUpdate={onQueuedFollowUpUpdate}\n onQueuedFollowUpSteer={onQueuedFollowUpSteer}\n onQueuedFollowUpCombine={onQueuedFollowUpCombine}\n queueSteeringUnavailableReason={queueSteeringUnavailableReason}\n unsavedQueueItemIds={unsavedQueueItemIds}\n queuedComposer={queuedComposer}\n queuedFollowUps={queuedFollowUps}\n streaming={streaming}\n workspaceHub={workspaceHub}\n />\n </Box>\n </Flex>\n </ChatQuestionNavigationContext>\n </ChatLinkProvider>\n </ChatImageHistoryContext>\n );\n};\n","import { Skeleton, Stack } from \"@chakra-ui/react\";\nimport { ChatMessage } from \"./ai-message\";\n\ninterface SkeletonLinesProps {\n widths: string[];\n}\n\nconst SkeletonLines = (props: SkeletonLinesProps) => {\n const { widths } = props;\n\n return (\n <Stack gap=\"xs\" w=\"full\">\n {widths.map((width, index) => (\n <Skeleton key={`${width}-${index}`} height=\"3\" width={width} borderRadius=\"xs\" />\n ))}\n </Stack>\n );\n};\n\nexport const ChatSkeleton = () => {\n return (\n <Stack minH=\"full\" py=\"xs\" gap=\"0\">\n <ChatMessage.Root from=\"user\">\n <ChatMessage.Content from=\"user\">\n <SkeletonLines widths={[\"72%\", \"46%\"]} />\n </ChatMessage.Content>\n </ChatMessage.Root>\n <ChatMessage.Root from=\"assistant\">\n <ChatMessage.Content from=\"assistant\">\n <SkeletonLines widths={[\"76%\", \"62%\", \"40%\"]} />\n </ChatMessage.Content>\n </ChatMessage.Root>\n </Stack>\n );\n};\n","import { Box, chakra, Flex, Portal, Stack, Text } from \"@chakra-ui/react\";\nimport { type PointerEvent, useState } from \"react\";\n\nexport interface ConversationBrowseItem {\n /** Turn id used to scroll the log to this user message. */\n id: string;\n /** The user message this tick indexes (shown in the hover card). */\n message: string;\n /** Optional assistant reply preview; hidden for a turn not yet answered. */\n reply?: string;\n}\n\ninterface ConversationBrowseProps {\n items: ConversationBrowseItem[];\n onSelect?: (id: string) => void;\n /** Overlay the log's left edge with a scrim instead of reserving a gutter (panels under ~480px). */\n floating?: boolean;\n}\n\n// The rail is a lens, not a chart: tick length encodes distance from the pointer, never content.\nconst MIN_USER_MESSAGES = 3;\nconst TICK_MIN_WIDTH = 10;\nconst TICK_MAX_WIDTH = 26;\nconst LENS_RADIUS = 4;\n\ninterface BrowseCardPosition {\n left: number;\n top: number;\n}\n\n// Raised-cosine falloff over LENS_RADIUS neighbours: 1 at the pointer, 0 at the edge of the lens.\nconst lensFactor = (index: number, pointerIndex: number | null) => {\n if (pointerIndex === null) return 0;\n const distance = Math.abs(index - pointerIndex);\n if (distance >= LENS_RADIUS) return 0;\n return (1 + Math.cos((Math.PI * distance) / LENS_RADIUS)) / 2;\n};\n\nconst tickColor = (index: number, pointerIndex: number | null) => {\n if (pointerIndex === null) return \"fg.subtle\";\n const distance = Math.abs(index - pointerIndex);\n if (distance < 0.5) return \"fg\";\n if (distance < LENS_RADIUS) return \"fg.muted\";\n return \"fg.subtle\";\n};\n\nconst ConversationBrowseCard = (props: { item: ConversationBrowseItem; position: BrowseCardPosition }) => {\n const { item, position } = props;\n\n return (\n <Portal>\n <Box\n position=\"fixed\"\n left={`${position.left}px`}\n ml=\"2xs\"\n top={`${position.top}px`}\n transform=\"translateY(-50%)\"\n w=\"80\"\n maxW=\"80\"\n zIndex=\"popover\"\n pointerEvents=\"none\"\n >\n <Stack gap=\"1.5\" p=\"3\" bg=\"bg.elevated\" borderWidth=\"1px\" borderColor=\"border\" borderRadius=\"lg\">\n <Text textStyle=\"label/S/medium\" color=\"fg\" lineClamp={2}>\n {item.message}\n </Text>\n {item.reply ? (\n <Text textStyle=\"label/XS/regular\" color=\"fg.muted\" lineClamp={2}>\n {item.reply}\n </Text>\n ) : null}\n </Stack>\n </Box>\n </Portal>\n );\n};\n\n/**\n * ChatBrowse — the conversation scrubber for the chat log's left gutter. One tick per user\n * message, in order; the ticks nearest the pointer swell into a lens (growing along X only, so\n * the row you aim at never moves), and the active tick raises a preview card. Clicking a tick\n * selects that turn. Hidden below a few messages, where a gutter costs space and buys nothing.\n */\nexport const ConversationBrowse = (props: ConversationBrowseProps) => {\n const { items, onSelect, floating = false } = props;\n const [pointerIndex, setPointerIndex] = useState<number | null>(null);\n const [cardPosition, setCardPosition] = useState<BrowseCardPosition | null>(null);\n\n if (items.length < MIN_USER_MESSAGES) return null;\n\n const handlePointerMove = (event: PointerEvent<HTMLDivElement>) => {\n const rect = event.currentTarget.getBoundingClientRect();\n const fraction = (event.clientY - rect.top) / rect.height;\n const next = Math.min(items.length - 1, Math.max(0, fraction * items.length - 0.5));\n const nextActiveIndex = Math.round(next);\n setPointerIndex(next);\n setCardPosition({\n left: rect.right,\n top: rect.top + ((nextActiveIndex + 0.5) / items.length) * rect.height,\n });\n };\n\n const activeIndex = pointerIndex === null ? null : Math.round(pointerIndex);\n const activeItem = activeIndex === null ? null : items[activeIndex];\n\n return (\n <Box position=\"relative\" w=\"10\" flexShrink={0}>\n <Flex\n direction=\"column\"\n align=\"flex-start\"\n gap=\"1.5\"\n px=\"1.5\"\n py=\"2\"\n w=\"10\"\n onPointerMove={handlePointerMove}\n onPointerLeave={() => setPointerIndex(null)}\n {...(floating\n ? {\n position: \"absolute\",\n insetInlineStart: 0,\n top: 0,\n bottom: 0,\n // The scrim must be the surface the rail covers — the panel's own bg, never a lighter tone.\n bg: \"bg\",\n }\n : {})}\n >\n {items.map((item, index) => (\n <chakra.button\n type=\"button\"\n key={item.id}\n h=\"2px\"\n w={`${TICK_MIN_WIDTH + (TICK_MAX_WIDTH - TICK_MIN_WIDTH) * lensFactor(index, pointerIndex)}px`}\n bg={tickColor(index, pointerIndex)}\n borderRadius=\"1px\"\n transition=\"width 80ms linear, background-color 80ms linear\"\n aria-label={`Jump to message ${index + 1}`}\n onClick={() => onSelect?.(item.id)}\n />\n ))}\n </Flex>\n {activeItem && cardPosition ? <ConversationBrowseCard item={activeItem} position={cardPosition} /> : null}\n </Box>\n );\n};\n","import {\n Button,\n chakra,\n Field,\n HStack,\n Icon,\n Input,\n Menu,\n Popover,\n Portal,\n Stack,\n Tag,\n Text,\n useSlotRecipe,\n} from \"@chakra-ui/react\";\nimport { useState } from \"react\";\nimport { ListRow } from \"@/components/list-row/list-row\";\nimport { getIconComponent } from \"@/components/primitives/icon-options\";\nimport { Tooltip } from \"@/components/primitives/tooltip\";\n\ninterface HarnessAction {\n id: string;\n label: string;\n icon?: string;\n argument?: { label: string; value?: string };\n}\ninterface HarnessMode {\n id: string;\n label: string;\n description: string;\n state: string;\n indicator?: { label: string; tone: \"neutral\" | \"info\" | \"success\" | \"warning\" | \"error\" };\n tagText?: string;\n closeActionId?: string;\n confirmation?: { id: string; title: string; actionId: string; cancelLabel?: string };\n actions: HarnessAction[];\n}\ninterface LocalTag {\n label: string;\n description: string;\n onClose: () => void;\n closeLabel?: string;\n}\nexport interface HarnessControlsProps {\n modes: HarnessMode[];\n draftTag?: LocalTag;\n sentTag?: LocalTag;\n pending?: boolean;\n unavailable?: boolean;\n onRequestConfirmation?: (modeId: string) => void;\n onAction: (modeId: string, actionId: string, argument?: string, modeSnapshot?: HarnessMode) => Promise<void>;\n}\n\nconst LocalModeTag = (props: { tag: LocalTag }) => {\n const { tag } = props;\n return (\n <Menu.Root>\n <Tooltip content={tag.description} openDelay={300} closeDelay={150}>\n <Tag.Root variant=\"ticket\" size=\"composer\">\n <Menu.Trigger asChild>\n <Tag.Label asChild>\n <button type=\"button\" aria-label={tag.description}>\n {tag.label}\n </button>\n </Tag.Label>\n </Menu.Trigger>\n <Tag.CloseTrigger aria-label={tag.closeLabel ?? `Remove ${tag.label}`} onClick={tag.onClose} />\n </Tag.Root>\n </Tooltip>\n <Portal>\n <Menu.Positioner>\n <Menu.Content>\n <Text p=\"sm\" textStyle=\"label/S/regular\" overflowWrap=\"anywhere\">\n {tag.description}\n </Text>\n </Menu.Content>\n </Menu.Positioner>\n </Portal>\n </Menu.Root>\n );\n};\n\nconst NativeModeTag = (props: {\n mode: HarnessMode;\n pending?: boolean;\n unavailable?: boolean;\n onRequestConfirmation?: HarnessControlsProps[\"onRequestConfirmation\"];\n onAction: HarnessControlsProps[\"onAction\"];\n}) => {\n const { mode, pending, unavailable, onRequestConfirmation, onAction } = props;\n const styles = useSlotRecipe({ key: \"menu\" })();\n const [editing, setEditing] = useState<{ action: HarnessAction; mode: HarnessMode } | null>(null);\n const [argument, setArgument] = useState(\"\");\n const [open, setOpen] = useState(false);\n const closeAction = mode.actions.find((action) => action.id === mode.closeActionId && !action.argument);\n const invoke = async (action: HarnessAction, value?: string, modeSnapshot = mode) => {\n try {\n await onAction(mode.id, action.id, value, modeSnapshot);\n setEditing(null);\n setOpen(false);\n return true;\n } catch {\n /* The conversation owns operation errors. Keep the native tag until readback. */\n return false;\n }\n };\n let status = mode.state;\n if (pending) status = `Checking · Last confirmed: ${mode.state}`;\n if (unavailable) status = `Status unavailable · Last confirmed: ${mode.state}`;\n return (\n <Popover.Root\n open={open}\n positioning={{ placement: \"top-start\" }}\n onOpenChange={(details) => {\n setOpen(details.open);\n if (!details.open) setEditing(null);\n }}\n >\n <Tooltip content={`${mode.label}: ${mode.description} · ${status}`} openDelay={300} closeDelay={150}>\n <Tag.Root variant=\"ticket\" size=\"composer\">\n {mode.indicator ? (\n <Tag.StartElement>\n <chakra.span\n role=\"img\"\n aria-label={unavailable ? \"Status unavailable\" : mode.indicator.label}\n data-status-dot=\"\"\n data-tone={unavailable ? \"neutral\" : mode.indicator.tone}\n />\n </Tag.StartElement>\n ) : null}\n <Popover.Trigger asChild>\n <Tag.Label asChild>\n <button type=\"button\" aria-label={`${mode.label} details`}>\n {mode.label}\n </button>\n </Tag.Label>\n </Popover.Trigger>\n {closeAction ? (\n <Tag.CloseTrigger\n aria-label={closeAction.label}\n disabled={pending || unavailable}\n onClick={() => void invoke(closeAction)}\n />\n ) : null}\n </Tag.Root>\n </Tooltip>\n <Portal>\n <Popover.Positioner>\n <Popover.Content css={styles.content} aria-label={`${mode.label} details`}>\n <Stack p=\"sm\" gap=\"xs\">\n <Text textStyle=\"label/S/medium\">{mode.label}</Text>\n <Text textStyle=\"label/S/regular\" overflowWrap=\"anywhere\">\n {mode.description}\n </Text>\n <Text textStyle=\"label/XS/regular\" color=\"fg.muted\">\n {status}\n </Text>\n {editing?.action.argument ? (\n <Field.Root>\n <Field.Label>{editing.action.argument.label}</Field.Label>\n <Input autoFocus size=\"sm\" value={argument} onChange={(event) => setArgument(event.target.value)} />\n <HStack>\n <Button size=\"xs\" variant=\"ghost\" onClick={() => setEditing(null)}>\n Cancel\n </Button>\n <Button\n size=\"xs\"\n variant=\"ghost\"\n disabled={pending || unavailable || !argument.trim()}\n onClick={() => void invoke(editing.action, argument, editing.mode)}\n >\n Apply\n </Button>\n </HStack>\n </Field.Root>\n ) : null}\n </Stack>\n {!editing\n ? mode.actions.map((action) => (\n <ListRow\n key={action.id}\n role=\"button\"\n variant=\"full-width\"\n label={action.label}\n icon={action.icon ? <Icon as={getIconComponent(action.icon)} boxSize=\"icon-xs\" /> : undefined}\n disabled={\n pending || unavailable || (action.id === mode.confirmation?.actionId && !onRequestConfirmation)\n }\n onActivate={() => {\n if (action.id === mode.confirmation?.actionId) {\n setOpen(false);\n onRequestConfirmation?.(mode.id);\n } else if (action.argument) {\n setArgument(action.argument.value ?? \"\");\n setEditing({ action, mode });\n } else void invoke(action);\n }}\n />\n ))\n : null}\n </Popover.Content>\n </Popover.Positioner>\n </Portal>\n </Popover.Root>\n );\n};\n\nexport const HarnessControls = (props: HarnessControlsProps) => {\n const { modes, draftTag, sentTag, pending, unavailable, onRequestConfirmation, onAction } = props;\n return (\n <HStack gap=\"2xs\" minW=\"0\" aria-label=\"Harness controls\">\n {modes.map((mode) => (\n <NativeModeTag\n key={mode.id}\n mode={mode}\n pending={pending}\n unavailable={unavailable}\n onRequestConfirmation={onRequestConfirmation}\n onAction={onAction}\n />\n ))}\n {draftTag ? <LocalModeTag tag={draftTag} /> : null}\n {sentTag ? <LocalModeTag tag={sentTag} /> : null}\n </HStack>\n );\n};\n","import { Flex, HStack, Spinner, Text } from \"@chakra-ui/react\";\nimport { AlertTriangle } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\ntype WorkspaceHubStatus = \"ready\" | \"loading\" | \"error\";\n\ninterface ChatWorkspaceHubProps {\n /** Workspace identity/selector shown at the start of the header (e.g. GitBranch + name). */\n workspaceControl?: ReactNode;\n additions: number;\n deletions: number;\n /** Icon-only action that opens the workspace resource. */\n action?: ReactNode;\n status?: WorkspaceHubStatus;\n statusLabel?: string;\n}\n\nconst HubStatus = (props: {\n status: WorkspaceHubStatus;\n statusLabel?: string;\n additions: number;\n deletions: number;\n}) => {\n const { status, statusLabel, additions, deletions } = props;\n\n if (status === \"loading\") {\n return (\n <HStack gap=\"2xs\" minW=\"0\">\n <Spinner size=\"xs\" color=\"fg.muted\" />\n <Text textStyle=\"label/XS/regular\" color=\"fg.muted\" truncate>\n {statusLabel ?? \"Setting up workspace...\"}\n </Text>\n </HStack>\n );\n }\n\n if (status === \"error\") {\n return (\n <HStack gap=\"2xs\" minW=\"0\">\n <AlertTriangle size={14} color=\"var(--chakra-colors-fg-error)\" />\n <Text textStyle=\"label/XS/regular\" color=\"fg.error\" truncate>\n {statusLabel ?? \"Workspace setup failed\"}\n </Text>\n </HStack>\n );\n }\n\n // Ready: the diff counts take the slot, and only when there is something to show.\n if (additions <= 0 && deletions <= 0) return null;\n\n return (\n <HStack gap=\"2xs\">\n <Text textStyle=\"label/XS/medium\" color=\"fg.success\">\n +{additions}\n </Text>\n <Text textStyle=\"label/XS/medium\" color=\"fg.error\">\n −{deletions}\n </Text>\n </HStack>\n );\n};\n\n/**\n * Workspace hub header: the frame the session sits in. The identity is always present;\n * the slot beside it carries the diff counts, or the setup status while the workspace is\n * being created or has failed. The open action recedes during setup.\n */\nexport const ChatWorkspaceHub = (props: ChatWorkspaceHubProps) => {\n const { workspaceControl, additions, deletions, action, status = \"ready\", statusLabel } = props;\n\n return (\n <Flex align=\"center\" justify=\"space-between\" gap=\"sm\" minW=\"0\" pl=\"xs\" pr=\"2xs\" py=\"2xs\">\n <HStack gap=\"sm\" minW=\"0\">\n {workspaceControl}\n <HubStatus status={status} statusLabel={statusLabel} additions={additions} deletions={deletions} />\n </HStack>\n {action ? <Flex flexShrink={0}>{action}</Flex> : null}\n </Flex>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAaE,WAA4B;CAAA,IAAAC,IAAAC,EAAA,CAAA,GACvC,EAAAC,cAAAC,eAAAC,sBAAkDN,GAAwB,GAAEO,GAAAC;CAC5ET,AAD4EG,EAAA,OAAAE,KAAAF,EAAA,OAAAI,KAAAJ,EAAA,OAAAG,KAC5DE,UAAA;EACd,IAAAE,IAAiBL,EAASM;EAC1B,IAAI,CAACD,GAAQ;EACb,IAAAE,IAAa,IACbC,IAAe;GAAAC,KAAOJ,EAAQK;GAAUC,QAAU;EAAK,GACvDC,IAAY,GACZC,UAAyB;GACvB,AAAIN,KAAUF,EAAQS,eAAgB,CAAC,CAAAC,WAAY,MACnDP,IAAWA;IAAAA,KACJH,EAAQK;IAAUC,QACfN,EAAQW,eAAgBX,EAAQY,eAAgBZ,EAAQK,YAAa;GAC/E;EAHQ,GAKVQ,IAAiB,IAAIC,qBAAe;GAElC,IADiBd,EAAQS,eAAgB,CAAC,CAAAC,WAAY,GAGpDd,AADAM,IAASA,IACTN,EAAW;QACN,IAAIM,GAAM;IACfA,IAASA;IACT,IAAAc,IAAcb;IAGdI,AAFAX,EAAW,GACXI,EAAQK,YAAaW,EAAKZ,KAC1BG,IAAQU,4BAAsB;KAC5B,AAAID,EAAKV,SAAcT,EAAe,SAAS,IAC1CG,EAAQK,YAAaW,EAAKZ;IAAK,CACrC;GAHI;EAIN,CACF;EAEyB,OAD1BJ,EAAQkB,iBAAkB,UAAUV,CAAgB,GACpDK,EAAQM,QAASnB,CAAQ,SAClB;GAGLA,AAFAoB,qBAAqBb,CAAK,GAC1BM,EAAQQ,WAAY,GACpBrB,EAAQsB,oBAAqB,UAAUd,CAAgB;EA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