From fd2219c935df402acf77b6218dbac1268ceaa1a1 Mon Sep 17 00:00:00 2001 From: "pouriade.com" Date: Tue, 27 Oct 2026 22:34:00 -0700 Subject: [PATCH] Share one shell between thought and tool steps StepDetails holds the row, chevron, timer, and open-once body. Thought builds its own label, the rail dot and badge read lookup tables, and one hook keeps the finished summary. --- apps/web/src/parts/WorkSteps.tsx | 239 +++++++++++++++++-------------- 1 file changed, 134 insertions(+), 105 deletions(-) diff --git a/apps/web/src/parts/WorkSteps.tsx b/apps/web/src/parts/WorkSteps.tsx index 1e25131..80363bb 100644 --- a/apps/web/src/parts/WorkSteps.tsx +++ b/apps/web/src/parts/WorkSteps.tsx @@ -86,16 +86,21 @@ function Activity(props: ActivityProps) { ) } -/** What some finished steps did, totalling the thinking time when every step was timed. */ -const finishedSummary = (steps: Step[], scope: string | undefined) => - stepsSummary( - steps, - (step) => { - const id = clockId(scope, step) - return id ? stepDuration(id) : undefined - }, - formatSeconds, - (tool) => toolEntry(tool).label, +/** + * What some finished steps did, totalling the thinking time when every step was timed, and kept up + * to date as each step records its time when it stops. + */ +const useFinishedSummary = (steps: Step[], scope: string | undefined) => + useStepDurations(() => + stepsSummary( + steps, + (step) => { + const id = clockId(scope, step) + return id ? stepDuration(id) : undefined + }, + formatSeconds, + (tool) => toolEntry(tool).label, + ), ) /** @@ -113,8 +118,7 @@ const stepRow = cn( /** A run of reasoning and tool use, shown as it happens. */ export function WorkSteps(props: Props) { - // The finished summary totals the thinking time, which a step records when it stops. - const finished = useStepDurations(() => finishedSummary(props.steps, props.scope)) + const finished = useFinishedSummary(props.steps, props.scope) const last = props.steps.length - 1 const views = props.steps.map((step, i) => ( finishedSummary(props.steps, props.scope)) + const label = useFinishedSummary(props.steps, props.scope) return (