Repository navigation
chore : render answered user question outside agent steps #1394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
ea18999
64ff8c6
4b7e0a8
4820108
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@truefoundry/trueforge-ui": patch | ||
| --- | ||
|
|
||
| Keep answered user questions visible outside the collapsed Agent steps, without delaying the reply or repeating step counts. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,13 +14,14 @@ import { withSessionProps } from '../analytics/sessionProps.js'; | |
| import { useSlowActivityLabel } from '../hooks/useSlowActivityLabel.js'; | ||
| import { useOptionalShellMode } from '../server/ShellModeContext.js'; | ||
| import { useSlot } from '../theme/SlotsProvider.js'; | ||
| import { computeAgentStepsSplit } from '../utils/computeAgentStepsSplit.js'; | ||
| import { computeAgentStepsSplit, countAgentSteps } from '../utils/computeAgentStepsSplit.js'; | ||
| import { | ||
| isParallelToolGroupPart, | ||
| parallelGroupKeyForPart, | ||
| readParallelToolGroups, | ||
| } from '../utils/parallelToolGroups.js'; | ||
| import { loaderActivityKey, loaderActivityProgress, resolveLoaderLabel } from '../utils/resolveActivityLabel.js'; | ||
| import { ASK_USER_TOOL_NAME, getAskUserAnswerResult } from '../utils/toolCallParsing.js'; | ||
| import { AgentStepsContainer } from './AgentStepsContainer.js'; | ||
| import { AssistantLeafPartContainer } from './AssistantLeafPartContainer.js'; | ||
| import { AssistantTextContainer } from './AssistantTextContainer.js'; | ||
|
|
@@ -83,7 +84,13 @@ export function AssistantMessageContainer() { | |
| isCancelled && !isSessionReplay && cancellationReason === TURN_CANCELLATION_REASON.CANCELLED_FOR_NEXT_TURN; | ||
| const cancelledBanner = isCancelled && !hideCancelled ? cancellationLabel(cancellationReason) : undefined; | ||
|
|
||
| const { cutIndex, hasFinal, toolCount, thinkingCount } = computeAgentStepsSplit(parts, isMessageRunning); | ||
| const stepParts = parts.map(p => ({ | ||
| type: p.type, | ||
| text: p.type === 'text' ? p.text : undefined, | ||
| name: p.type === 'data' ? p.name : undefined, | ||
| hidden: isAnsweredAskUser(p), | ||
| })); | ||
| const { cutIndex, hasFinal } = computeAgentStepsSplit(stepParts, isMessageRunning); | ||
|
|
||
| // Built-in indicator modes hide the loader while reasoning streams; we want it there too. | ||
| // Hide when resume is unavailable (message stays "running" but no events arrive) or the | ||
|
|
@@ -105,6 +112,8 @@ export function AssistantMessageContainer() { | |
| } | ||
|
|
||
| if (index < cutIndex) { | ||
| // Answered user questions stay visible: render them outside the collapsible Agent steps. | ||
| if (isAnsweredAskUser(part)) return null; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Held-back reply splits into empty accordionMedium Severity Ungrouping an answered question splits Agent steps, so while the 500-character holdback is still active the trailing reply is grouped into a new accordion after the question. Earlier tools still count as steps before the cut, so Additional Locations (1)Reviewed by Cursor Bugbot for commit 4820108. Configure here. |
||
| if (part.type === 'reasoning') { | ||
| return ['group-agentSteps', 'group-reasoning']; | ||
| } | ||
|
|
@@ -136,12 +145,14 @@ export function AssistantMessageContainer() { | |
| <MessagePrimitive.GroupedParts groupBy={groupBy} indicator="never"> | ||
| {({ part, children }) => { | ||
| switch (part.type) { | ||
| case 'group-agentSteps': | ||
| case 'group-agentSteps': { | ||
| const { toolCount, thinkingCount } = countAgentSteps(part.indices.flatMap(i => stepParts[i] ?? [])); | ||
| return ( | ||
| <AgentStepsContainer toolCount={toolCount} thinkingCount={thinkingCount} hasFinal={hasFinal}> | ||
| {children} | ||
| </AgentStepsContainer> | ||
| ); | ||
| } | ||
| case 'group-reasoning': | ||
| return <ReasoningContainer group={part as ThreadGroupPart} />; | ||
| case 'text': { | ||
|
|
@@ -174,3 +185,9 @@ export function AssistantMessageContainer() { | |
| </MessagePrimitive.Root> | ||
| ); | ||
| } | ||
|
|
||
| function isAnsweredAskUser(part: PartState): boolean { | ||
| return ( | ||
| part.type === 'tool-call' && part.toolName === ASK_USER_TOOL_NAME && getAskUserAnswerResult(part.result) != null | ||
| ); | ||
| } | ||


Uh oh!
There was an error while loading. Please reload this page.