Skip to content

Commit 8a892f5

Browse files
committed
Merge remote-tracking branch 'github/main' into takeover-23698-head
2 parents 45112eb + 05c0ed7 commit 8a892f5

2 files changed

Lines changed: 32 additions & 26 deletions

File tree

‎apps/web/src/components/chat/ThreadActivityBanners.tsx‎

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
type RunStopPresentation,
1212
} from "@t3tools/client-runtime/state/thread-execution";
1313
import { childThreadInputsTitle } from "@t3tools/client-runtime/state/threads";
14+
import { commandDisplayText } from "@t3tools/client-runtime/work-log/command-label";
1415
import { formatDuration } from "@t3tools/shared/orchestrationTiming";
1516
import * as DateTime from "effect/DateTime";
1617
import {
@@ -25,7 +26,6 @@ import {
2526
} from "lucide-react";
2627
import { Fragment } from "react";
2728
import { tickTextContent } from "~/lib/tickTextContent";
28-
import { cn } from "~/lib/utils";
2929
import { Button, InlineButton } from "../ui/button";
3030
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
3131
import type { ComposerBannerStackItem } from "./ComposerBannerStack";
@@ -174,6 +174,16 @@ export function backgroundWorkNowItem(input: {
174174
const subagent = item?.type === "subagent" ? item : undefined;
175175
return {
176176
task,
177+
label:
178+
item?.type === "command_execution" && commandDisplayText(item.input) === task.label ? (
179+
<span className="font-mono in-data-[slot=popover-popup]:whitespace-pre-wrap">
180+
{task.label}
181+
</span>
182+
) : task.label.includes("\n") ? (
183+
<span className="in-data-[slot=popover-popup]:whitespace-pre-wrap">{task.label}</span>
184+
) : (
185+
task.label
186+
),
177187
activity: subagent?.progress?.replace(/\s+/gu, " ").trim() || null,
178188
startedAtMs: item?.startedAt ? DateTime.toEpochMillis(item.startedAt) : null,
179189
updatedAtMs: subagent ? DateTime.toEpochMillis(subagent.updatedAt) : 0,
@@ -185,34 +195,32 @@ export function backgroundWorkNowItem(input: {
185195
.filter((row) => row.activity)
186196
.toSorted((left, right) => right.updatedAtMs - left.updatedAtMs)[0];
187197
const isCommand = (row: (typeof rows)[number]) => row.task.kind !== "subagent";
188-
const verb = presentation.waiting ? "Waiting on" : "Running";
189198
const onlyThreadId = only?.childThreadId;
190199
const startedAtMs = only?.startedAtMs ?? null;
191200
return {
192201
id: `background-work:${input.threadId}`,
193202
icon: rows.every(isCommand) ? <TerminalIcon /> : <CircleDashedIcon />,
194-
title: only ? (
195-
<>
196-
{verb}{" "}
197-
<span
198-
className={cn(
199-
isCommand(only) && "font-mono in-data-[slot=popover-popup]:whitespace-pre-wrap",
200-
)}
201-
>
202-
{only.task.label}
203-
</span>
204-
</>
205-
) : (
206-
presentation.title
207-
),
203+
title:
204+
only && typeof only.label !== "string" && only.task.label !== only.task.kind ? (
205+
<>
206+
{presentation.waiting ? "Waiting" : "Running"} · {only.label}
207+
</>
208+
) : (
209+
presentation.title
210+
),
208211
description: only ? (
209212
only.activity
210213
) : newest ? (
211-
`${newest.task.label}: ${newest.activity}`
212-
) : rows.every(isCommand) ? (
213-
<span className="font-mono">{rows.map((row) => row.task.label).join(", ")}</span>
214+
<>
215+
{newest.label}: {newest.activity}
216+
</>
214217
) : (
215-
rows.map((row) => row.task.label).join(", ")
218+
rows.map((row, index) => (
219+
<Fragment key={row.task.taskId}>
220+
{index > 0 ? ", " : null}
221+
{row.label}
222+
</Fragment>
223+
))
216224
),
217225
actions: (
218226
<>

‎packages/client-runtime/src/state/threadExecution.ts‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -433,12 +433,10 @@ export function presentPendingBackgroundWork(
433433
if (items.length === 1 && only !== undefined) {
434434
const noun = BACKGROUND_WORK_KINDS[only.kind].singular;
435435
const named = only.label !== noun;
436-
const title = waiting
437-
? named
438-
? `${only.kind === "monitor" ? "" : `Waiting on ${noun} `}${only.label}`
439-
: `Waiting on a ${noun}`
440-
: named
441-
? `Running: ${only.label}`
436+
const title = named
437+
? `${waiting ? "Waiting" : "Running"} · ${only.label}`
438+
: waiting
439+
? `Waiting on a ${noun}`
442440
: `Running a ${noun}`;
443441
return { title, items, waiting };
444442
}

0 commit comments

Comments
 (0)