Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
0281a8d
An app's steps are drawn one way, running or done, by the app's name
ataibarkai Dec 4, 2026
dd763b0
A run of steps on one app draws its logo once
ataibarkai Dec 4, 2026
313d885
A running line's text in the reduced-motion test includes "In progress"
ataibarkai Dec 5, 2026
0a69979
An app leads its run of steps: named once, with what was done on it u…
ataibarkai Dec 5, 2026
17f2e5b
A run of one app's steps is that app's line, and rows show its logo, …
ataibarkai Dec 5, 2026
78e9109
A turn's line on one app names it, and every app's logo names its app…
ataibarkai Dec 5, 2026
683d732
A turn's line on one app leads with its name, and its rows on that ap…
ataibarkai Dec 5, 2026
5bad4f4
A step that doesn't open draws its mark in the chevrons' column when …
ataibarkai Dec 5, 2026
cebebf0
A conversation's turn is one line from send to done: open while the B…
ataibarkai Dec 5, 2026
527f7e2
A turn's line folded at the end lets its rows go, and its layout test…
ataibarkai Dec 5, 2026
239a4d9
A turn's line names its app, then says what was done in lower case; w…
ataibarkai Dec 5, 2026
cda7ff3
The failed-send browser test reads the turn's open line: each miss a …
ataibarkai Dec 5, 2026
4b16cb5
"Thinking" on a turn's line is the conversation's own, with no mark b…
ataibarkai Dec 5, 2026
eaabf7a
The answered-approval browser test opens the first turn's line, where…
ataibarkai Dec 5, 2026
024be99
Merge main into approach B: the turn line keeps main's drawn-answer a…
ataibarkai Dec 5, 2026
4fa7adb
main's mended-send browser test reads the turn's line: the miss a row…
ataibarkai Dec 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
181 changes: 149 additions & 32 deletions app/src/components/channels/chat-transcript.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,19 @@ import {
} from "./telemetry-assistant-message";
import {
ActivityAppMarks,
AppMark,
appOfCall,
attachmentReadName,
dropRepeatedAppCards,
groupToolSteps,
LiveConnectorStep,
LineShowsApp,
onlyApp,
rowApps,
ServerStepIcon,
ToolActivity,
type ToolGroup,
type TranscriptItem,
useAppName,
useDrawnTool,
useReportsDesktopActivity,
} from "./tool-activity";
Expand All @@ -225,6 +230,7 @@ import {
type Turn,
turnsOf,
} from "./transcript-turns";
import { TurnLine } from "./turn-line";
import { VoiceChatCard } from "./voice-chat-card";

type ChatTranscriptProps = {
Expand Down Expand Up @@ -1949,7 +1955,6 @@ const ToolCallBody = memo(function ToolCallBody({
result,
latest,
spokeAfter,
liveConnector,
}: {
toolCallId: string;
name: string;
Expand All @@ -1959,7 +1964,6 @@ const ToolCallBody = memo(function ToolCallBody({
latest: boolean;
/** The Bot said something after this call in its turn. See `ToolPlace`. */
spokeAfter: boolean;
liveConnector?: boolean;
}) {
const renderToolCall = useRenderToolCall();
const toolCall = useMemo(
Expand Down Expand Up @@ -2029,7 +2033,6 @@ const ToolCallBody = memo(function ToolCallBody({
) : (
<ServerToolLine
args={args}
liveConnector={liveConnector}
name={name}
place={{ toolCallId, latest }}
result={result}
Expand Down Expand Up @@ -2083,8 +2086,9 @@ type ToolRowProps = {
latest: boolean;
/** The Bot said something after this row in its turn. See `ToolPlace`. */
spokeAfter: boolean;
conversation?: boolean;
expanded?: boolean;
/** A run of calls drawn as plain lines (a `tools` group), which folds, even a run of one. */
folds?: boolean;
/**
* A lone step drawn as the folded line of work rather than as its own line: a send that delivered
* nothing and that its reply made good (`mendedSends`).
Expand All @@ -2106,8 +2110,8 @@ export function sameToolRow(a: ToolRowProps, b: ToolRowProps): boolean {
a.inFlight === b.inFlight &&
a.latest === b.latest &&
a.spokeAfter === b.spokeAfter &&
a.conversation === b.conversation &&
a.expanded === b.expanded &&
a.folds === b.folds &&
a.workAlone === b.workAlone &&
a.steps.length === b.steps.length &&
a.steps.every((step, index) => {
Expand All @@ -2130,8 +2134,8 @@ const ToolRow = memo(function ToolRow({
inFlight,
latest,
spokeAfter,
conversation,
expanded,
folds,
workAlone,
}: ToolRowProps) {
const [only] = steps;
Expand All @@ -2143,13 +2147,16 @@ const ToolRow = memo(function ToolRow({
only &&
!workAlone &&
!isBrowserStep(only) &&
// Drawn open among a turn line's rows, a lone app call is a step as theirs are, not a line of
// its own beside them (`ToolActivity`). Any other lone call keeps the line that says what it
// did in its own words, drawn there on the rows' grid (`KeepChevronSlot`).
!(expanded && folds && appOfCall(only.toolCall.function.name)) &&
// A subtask is drawn as work even alone, so a second call joining it does not change its shape.
only.toolCall.function.name !== SUBAGENT_TOOL ? (
<ArgumentsArrivingContext.Provider value={active}>
<ToolCallBody
args={only.toolCall.function.arguments}
latest={latest}
liveConnector={conversation && inFlight}
name={only.toolCall.function.name}
result={only.result}
spokeAfter={spokeAfter}
Expand All @@ -2159,7 +2166,6 @@ const ToolRow = memo(function ToolRow({
) : (
<ToolActivity
active={active}
conversation={conversation}
expanded={expanded}
group={{ kind: "tools", id, steps }}
/>
Expand All @@ -2182,15 +2188,13 @@ export function ServerToolLine({
args,
result,
place,
liveConnector,
}: {
name: string;
/** What the call was given, as the model wrote it. Read only for what a step acted on. */
args?: string;
result?: string;
/** Where this call sits in the conversation, for an app card that may carry the task on. */
place?: CardPlace;
liveConnector?: boolean;
}) {
const running = result === undefined;
// Cut off with its outcome unknown: named as it is while under way, since nobody knows it was done.
Expand All @@ -2200,10 +2204,16 @@ export function ServerToolLine({
const appId =
!role && name.startsWith("mcp__") ? name.split("__")[1] : undefined;
const folders = useContext(FolderNamesContext);
const appName = useAppName();
// On the one app the folded line above it shows (`LineShowsApp`), it doesn't draw its logo again.
const lineShows = useContext(LineShowsApp);
// The file a file step read or saved, as a computer's own file steps name it; a step on a folder
// on the person's computer names the folder too ("todo.txt in share").
// on the person's computer names the folder too ("todo.txt in share"). An app's step doesn't say
// its app's name: its logo does, and names it on hover (`AppMark`).
const detail =
(appId && named.detail === appId ? connectorName(appId) : named.detail) ??
(appId && (named.detail === appId || named.detail === connectorName(appId))
? undefined
: named.detail) ??
folderStepSubject(name, args, folders) ??
ownToolSubject(name, args) ??
// The attached file a read was of, by the name its answer carries.
Expand Down Expand Up @@ -2262,12 +2272,6 @@ export function ServerToolLine({
? readAnotherAccountPrompt(answer)
: null;
if (another) return <AnotherAccountCard prompt={another} />;
if (running && liveConnector && appId)
return (
<div className="my-1.5">
<LiveConnectorStep appId={appId} label={label} />
</div>
);
/*
* THAT TOOL'S OTHER ANSWERS ARE FOR THE MODEL. An app nobody can name comes back as plain text
* telling the Bot to say so plainly and not to browse to it — an instruction, which read by the
Expand Down Expand Up @@ -2334,7 +2338,15 @@ export function ServerToolLine({
{...(failed && ownToolFailedLabel(name)
? { failedLabel: ownToolFailedLabel(name) ?? undefined }
: {})}
icon={<ServerStepIcon name={name} />}
{...(appId && appId === lineShows
? {}
: {
icon: appId ? (
<AppMark appId={appId} name={appName(appId)} />
) : (
<ServerStepIcon name={name} />
),
})}
label={label}
refused={refused}
failed={failed}
Expand Down Expand Up @@ -2671,6 +2683,21 @@ function TranscriptRenderersWatch({
);
}

/**
* How far a row of app steps is drawn up under one drawn like it, so the two sit as two steps of one
* list do, 8px apart: a "Worked for" line's rows are 12px apart, and an open list of steps keeps 4px
* above and below it, a call on a line of its own 6px.
*/
const JOINED = { list: "-mt-3", line: "-mt-4" } as const;

/**
* Whether a row with an app's steps is drawn as an open list of them or as one call's line: in a
* "Worked for" line, a run of them is a list, a lone one in a run included (`ToolRow`).
*/
function stepsShape(item: TranscriptItem): "list" | "line" {
return item.kind === "tools" ? "list" : "line";
}

export function ChatTranscript({
threadId,
busy = false,
Expand Down Expand Up @@ -2722,9 +2749,29 @@ export function ChatTranscript({
const taskThread = isTaskThread(threadId, items, queryClient);
// What waits on the person's approval stays out of the fold, its card with it.
const waiting = useWaitingToolCalls(queryClient);
/*
* A conversation's turn is one line from send to done (`TurnLine`): open while the Bot works,
* folded once it is done. A stopped turn is a turn that ended; its line stays open, since nothing
* outside it says what was done.
*/
// The turns that ran while this conversation was open: a turn with no steps folds its line away.
const watchedRef = useRef(new Set<string>());
const folds = taskThread
? foldTurnWork(items, busy, waiting)
: foldTurnWork(items, busy || Boolean(stopped), waiting, "conversation");
: foldTurnWork(items, busy, waiting, "conversation", watchedRef.current);
for (const work of folds.after?.values() ?? [])
if (work.running) watchedRef.current.add(work.askId);
/*
* Rows that have been part of a turn's line. One that comes out of it again (a step whose card
* the app came to draw only once it had loaded) has been on the page already: drawn on its own, it
* is at rest, not a row arriving, and does not fade in or type itself out a second time.
*/
const wereInLineRef = useRef(new Set<string>());
for (const id of folds.inside) wereInLineRef.current.add(id);
// The newest turn's line says "Thinking" itself, so the line of its own under the turn isn't drawn.
const turnLineLive = [...(folds.after?.values() ?? [])].some(
(work) => work.running,
);
// What the task read and made, for its Details pane beside the thread (`thread-work.ts`).
useEffect(() => {
if (taskThread && threadId)
Expand Down Expand Up @@ -3187,8 +3234,8 @@ export function ChatTranscript({
>
<ToolRow
active={busy && index === items.length - 1}
conversation={!taskThread}
expanded={expanded}
folds={item.kind === "tools"}
id={item.id}
inFlight={busy && index >= turnStart}
latest={index >= latestIndex}
Expand Down Expand Up @@ -3249,25 +3296,47 @@ export function ChatTranscript({
threadId={taskThread ? threadId : undefined}
work={work}
>
{work.rows.map((row) => (
<Fragment key={row.item.id}>
{rowContent(row.item, row.index, !taskThread)}
</Fragment>
))}
<LineShowsApp.Provider
value={onlyApp(work.rows.map((row) => row.item))}
>
{work.rows.map((row, at) => {
// App steps the Bot's words had split into rows of their own sit as one list: its
// words are drawn outside this line, and the gap they left says nothing in here. Only
// rows drawn alike: a call on a line of its own is a muted line, a list's steps aren't.
const above = work.rows[at - 1];
const shape = stepsShape(row.item);
const joins =
above !== undefined &&
stepsShape(above.item) === shape &&
rowApps(above.item).last !== undefined &&
rowApps(row.item).first !== undefined;
const drawn = rowContent(row.item, row.index, !taskThread);
return (
<Fragment key={row.item.id}>
{joins ? (
<div className={JOINED[shape]}>{drawn}</div>
) : (
drawn
)}
</Fragment>
);
})}
</LineShowsApp.Provider>
</WorkedFor>
</MessageScrollerItem>
);
if (taskWork.folds.inside.has(item.id)) return null;
// A refused turn's notice, under the last row of the person's message it answered.
const refusal = refusedUnder.get(item.id);
const turnLine = taskWork.folds.after?.get(item.id);
/*
* Under an answer the Bot drew: the way to keep it as an artifact, once its turn is over. Not on
* a read-only row, whose presses go nowhere.
*/
const ask = artifactAsks.get(item.id);
const offersArtifact =
ask !== undefined && onMakeArtifact !== undefined && !readOnly;
return (
const row = (
<MessageScrollerItem
key={item.id}
messageId={item.id}
Expand All @@ -3285,7 +3354,13 @@ export function ChatTranscript({
: {})}
{...rowGuard}
>
{rowContent(item, index)}
{wereInLineRef.current.has(item.id) ? (
<ArrivalsLiveContext.Provider value={AT_REST}>
{rowContent(item, index)}
</ArrivalsLiveContext.Provider>
) : (
rowContent(item, index)
)}
{/*
* Beside the drawn answer, never around it: wrapping the row once its turn ended would mount
* the interface again, and an interface drawn in a frame would load again.
Expand Down Expand Up @@ -3313,6 +3388,47 @@ export function ChatTranscript({
) : null}
</MessageScrollerItem>
);
if (!turnLine) return row;
const opening = openingProps(turnLine.id);
return [
row,
/*
* A ROW OF ITS OWN, AFTER THE PERSON'S MESSAGE, FROM THE MOMENT THEY SEND. Keyed by the turn, so
* it is the same line from "Thinking" to "Worked through 2 steps". The column's gap under it is
* taken back: the line keeps its own, twelve pixels, the gap between the rows inside it, so the
* Bot's words below it, once they join it, are where they were, and a line that folds away
* takes its gap with it.
*/
<MessageScrollerItem
key={turnLine.id}
messageId={turnLine.id}
{...opening}
className={cn("-mb-6", opening.className)}
{...rowGuard}
>
<TurnLine
mended={mended}
reconnecting={turnLine.running && reconnectingNow}
work={turnLine}
>
{turnLine.rows.map((inside) =>
inside.item.kind === "text" ? (
// What the Bot said on the way: muted, at the size it was said, in its place.
<div
className="text-muted-foreground [--color-foreground:var(--color-muted-foreground)]"
key={inside.item.id}
>
{rowContent(inside.item, inside.index, true)}
</div>
) : (
<Fragment key={inside.item.id}>
{rowContent(inside.item, inside.index, true)}
</Fragment>
),
)}
</TurnLine>
</MessageScrollerItem>,
];
};

const hasConnector = visible.some(
Expand Down Expand Up @@ -3422,7 +3538,7 @@ export function ChatTranscript({
<ArrivalsLiveContext.Provider value={AT_REST}>
{items
.slice(pages.from, pages.split)
.map((item, offset) =>
.flatMap((item, offset) =>
renderRow(item, pages.from + offset),
)}
</ArrivalsLiveContext.Provider>
Expand All @@ -3436,7 +3552,8 @@ export function ChatTranscript({
reason={stopped}
/>
)
) : waitingOnTheModel || reconnectingNow ? (
) : (waitingOnTheModel || reconnectingNow) &&
!turnLineLive ? (
<Thinking reconnecting={reconnectingNow} />
) : null}
{working}
Expand All @@ -3461,7 +3578,7 @@ export function ChatTranscript({
</div>
{items
.slice(pages.split)
.map((item, offset) =>
.flatMap((item, offset) =>
renderRow(item, pages.split + offset),
)}
</MessageScrollerContent>
Expand Down
Loading
Loading