fix(chat): keep live tool labels in present tense (#9316)
Co-authored-by: maria-rcks <[email protected]>
This commit is contained in:
1 parent
922bd69225
commit
ec44bc56f5
8 files changed
+54
-37
No files matched your search
@@ -868,7 +868,7 @@ describe("buildThreadFeed", () => {
|
||||
title: "Call MCP tool",
|
||||
item: { server: "t3-code", tool: "preview_click" },
|
||||
status: undefined,
|
||||
displayName: "Click in the preview browser",
|
||||
displayName: "Clicking in the preview browser",
|
||||
liveDisplayName: "Clicking in the preview browser",
|
||||
settledDisplayName: "Clicked in the preview browser",
|
||||
icon: "browser",
|
||||
@@ -879,7 +879,7 @@ describe("buildThreadFeed", () => {
|
||||
title: "Call MCP tool",
|
||||
item: { server: "t3-code", tool: "task_status" },
|
||||
status: undefined,
|
||||
displayName: "Get delegated task status",
|
||||
displayName: "Getting delegated task status",
|
||||
liveDisplayName: "Getting delegated task status",
|
||||
settledDisplayName: "Got delegated task status",
|
||||
icon: "t3-code",
|
||||
@@ -1039,7 +1039,7 @@ describe("buildThreadFeed", () => {
|
||||
).toMatchObject([
|
||||
{
|
||||
type: "work-toggle",
|
||||
summary: "Clicked in the preview browser",
|
||||
summary: "Clicking in the preview browser",
|
||||
summaryToolIcon: "browser",
|
||||
live: true,
|
||||
},
|
||||
@@ -1050,18 +1050,20 @@ describe("buildThreadFeed", () => {
|
||||
{
|
||||
status: "completed",
|
||||
displayName: "Clicked in the preview browser",
|
||||
liveDisplayName: "Clicking in the preview browser",
|
||||
detail: "Clicked Continue",
|
||||
hasFailure: false,
|
||||
},
|
||||
{
|
||||
status: "failed",
|
||||
displayName: "Failed to click in the preview browser",
|
||||
liveDisplayName: "Failed to click in the preview browser",
|
||||
detail: "Timed out waiting for Continue",
|
||||
hasFailure: true,
|
||||
},
|
||||
])(
|
||||
"uses the browser call label once its action settles as $status",
|
||||
({ status, displayName, detail, hasFailure }) => {
|
||||
({ status, displayName, liveDisplayName, detail, hasFailure }) => {
|
||||
const turnId = TurnId.make("turn-preview-lifecycle");
|
||||
const toolCallId = "preview-click";
|
||||
const groupId = `work-group:tool:${turnId}:${toolCallId}`;
|
||||
@@ -1156,7 +1158,7 @@ describe("buildThreadFeed", () => {
|
||||
groupId,
|
||||
hiddenCount: 1,
|
||||
expanded: true,
|
||||
summary: displayName,
|
||||
summary: liveDisplayName,
|
||||
summaryToolIcon: "browser",
|
||||
hasFailure,
|
||||
live: true,
|
||||
@@ -1677,7 +1679,7 @@ describe("buildThreadFeed", () => {
|
||||
(
|
||||
[
|
||||
{ lifecycleStatus: "inProgress", summary: "Running pnpm", shimmer: true },
|
||||
{ lifecycleStatus: "completed", summary: "Ran pnpm", shimmer: false },
|
||||
{ lifecycleStatus: "completed", summary: "Running pnpm", shimmer: false },
|
||||
{ lifecycleStatus: "failed", summary: "Failed pnpm", shimmer: false },
|
||||
{ lifecycleStatus: "declined", summary: "Declined pnpm", shimmer: false },
|
||||
{ lifecycleStatus: "stopped", summary: "Stopped pnpm", shimmer: false },
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
commandDetailRepeatsCommand,
|
||||
extractCommandOutputText,
|
||||
isWorktreeSetupActivity,
|
||||
liveActivityToolStatus,
|
||||
normalizeCompactToolLabel,
|
||||
omitSupersededLifecycleMarkers,
|
||||
resolveWorkEntryToolPresentation,
|
||||
@@ -1528,7 +1529,7 @@ function appendToolGroupRows(
|
||||
const latestActivity = latestActiveActivity ?? activities.at(-1)!;
|
||||
const singleActivity = activities.length === 1 ? latestActivity : null;
|
||||
const summary = live
|
||||
? liveToolActivitySummary(latestActivity, active)
|
||||
? liveToolActivitySummary(latestActivity, live)
|
||||
: singleActivity !== null &&
|
||||
singleActivity.toolLike &&
|
||||
toolGroupAction(singleActivity.workEntry) !== "edit"
|
||||
@@ -1580,16 +1581,16 @@ function appendToolGroupRows(
|
||||
});
|
||||
}
|
||||
|
||||
function liveToolActivitySummary(activity: ThreadFeedActivity, active: boolean): string {
|
||||
const presentation = resolveWorkEntryToolPresentation(
|
||||
activity.workEntry,
|
||||
active ? "inProgress" : "completed",
|
||||
);
|
||||
function liveToolActivitySummary(activity: ThreadFeedActivity, presentTense: boolean): string {
|
||||
const status = liveActivityToolStatus(activity.lifecycleStatus, presentTense);
|
||||
const presentation = resolveWorkEntryToolPresentation({
|
||||
...activity.workEntry,
|
||||
toolLifecycleStatus: status,
|
||||
});
|
||||
if (presentation) return presentation.displayName;
|
||||
const command = activity.workEntry.command?.trim();
|
||||
if (command) {
|
||||
const program = commandProgramName(command);
|
||||
const status = activity.lifecycleStatus ?? (active ? "inProgress" : "completed");
|
||||
const verb =
|
||||
status === "inProgress"
|
||||
? "Running"
|
||||
|
||||
Reference in new issue
Block a user