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
@@ -99,13 +99,16 @@ describe("work entry labels", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("does not describe a finished call as still running while the turn continues", () => {
|
||||
it("keeps the latest live activity in the present tense after the call completes", () => {
|
||||
const browserEntry = {
|
||||
...entry,
|
||||
toolTitle: "T3-code.preview_click",
|
||||
toolLifecycleStatus: "completed" as const,
|
||||
};
|
||||
expect(liveWorkEntryLabel(browserEntry, undefined, true)).toBe(
|
||||
"Clicking in the preview browser",
|
||||
);
|
||||
expect(liveWorkEntryLabel(browserEntry, undefined, false)).toBe(
|
||||
"Clicked in the preview browser",
|
||||
);
|
||||
});
|
||||
@@ -134,21 +137,21 @@ describe("work entry labels", () => {
|
||||
});
|
||||
|
||||
it.each([
|
||||
["inProgress", "Running vp"],
|
||||
["completed", "Ran vp"],
|
||||
["failed", "Failed vp"],
|
||||
["declined", "Declined vp"],
|
||||
["stopped", "Stopped vp"],
|
||||
["inProgress", "Running vp", "Running vp"],
|
||||
["completed", "Running vp", "Ran vp"],
|
||||
["failed", "Failed vp", "Failed vp"],
|
||||
["declined", "Declined vp", "Declined vp"],
|
||||
["stopped", "Stopped vp", "Stopped vp"],
|
||||
] as const)(
|
||||
"uses the command's %s outcome even while the turn continues",
|
||||
(toolLifecycleStatus, label) => {
|
||||
"uses present tense for a live %s command and the outcome once it is no longer live",
|
||||
(toolLifecycleStatus, liveLabel, settledLabel) => {
|
||||
const commandEntry = {
|
||||
...entry,
|
||||
command: "/bin/bash -lc 'vp test run'",
|
||||
toolLifecycleStatus,
|
||||
};
|
||||
expect(liveWorkEntryLabel(commandEntry, undefined, true)).toBe(label);
|
||||
expect(liveWorkEntryLabel(commandEntry, undefined, false)).toBe(label);
|
||||
expect(liveWorkEntryLabel(commandEntry, undefined, true)).toBe(liveLabel);
|
||||
expect(liveWorkEntryLabel(commandEntry, undefined, false)).toBe(settledLabel);
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import * as Equal from "effect/Equal";
|
||||
import { renderCodexDirectivesForCopy } from "@t3tools/client-runtime/codex-markdown-directives";
|
||||
import { commandProgramName } from "@t3tools/client-runtime/work-log/command-label";
|
||||
import {
|
||||
liveActivityToolStatus,
|
||||
normalizeCompactToolLabel,
|
||||
omitSupersededLifecycleMarkers,
|
||||
resolveWorkEntryToolPresentation,
|
||||
@@ -65,14 +66,14 @@ export function liveWorkEntryLabel(
|
||||
workspaceRoot: string | undefined,
|
||||
active: boolean,
|
||||
) {
|
||||
const toolPresentation = resolveWorkEntryToolPresentation(
|
||||
entry,
|
||||
active ? "inProgress" : "completed",
|
||||
);
|
||||
const status = liveActivityToolStatus(entry.toolLifecycleStatus, active);
|
||||
const toolPresentation = resolveWorkEntryToolPresentation({
|
||||
...entry,
|
||||
toolLifecycleStatus: status,
|
||||
});
|
||||
if (toolPresentation) return toolPresentation.displayName;
|
||||
const command = entry.command?.trim();
|
||||
if (command) {
|
||||
const status = entry.toolLifecycleStatus ?? (active ? "inProgress" : "completed");
|
||||
const verb =
|
||||
status === "inProgress"
|
||||
? "Running"
|
||||
|
||||
@@ -1224,7 +1224,7 @@ describe("MessagesTimeline", () => {
|
||||
expect(markup).toContain('data-timeline-row-id="live-activity-row"');
|
||||
});
|
||||
|
||||
it("keeps the completed command in the shared activity row with a past-tense label", () => {
|
||||
it("keeps the completed command in the shared activity row with a present-tense label", () => {
|
||||
const turnId = TurnId.make("turn-live");
|
||||
const markup = renderToStaticMarkup(
|
||||
<MessagesTimeline
|
||||
@@ -1259,10 +1259,10 @@ describe("MessagesTimeline", () => {
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(markup).toContain("Ran pnpm");
|
||||
expect(markup).toContain("Running pnpm");
|
||||
expect(markup).toContain("lucide-terminal");
|
||||
expect(markup).toContain("live-activity-focus");
|
||||
expect(markup).not.toContain("Running pnpm");
|
||||
expect(markup).not.toContain("Ran pnpm");
|
||||
expect(markup).not.toContain("Thinking");
|
||||
expect(markup).not.toContain('data-timeline-row-kind="thinking"');
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user