Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,10 @@
cursor: pointer;
}

.toolSummary {
font: var(--text-xs-medium);
}

.rowSummary svg {
flex: 0 0 auto;
color: var(--muted);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,13 @@ describe("collaboration activity turns", () => {
expect(screen.queryByRole("button", { name: "Tester · Turn 2" })).not.toBeInTheDocument();
await user.click(screen.getByRole("button", { name: "Developer · Turn 1" }));
const records = screen.getByRole("list", { name: "This turn · Execution order" });
expect(within(records).getByText(/dev-turn-command-0$/)).toBeVisible();
expect(within(records).getByText(/dev-turn-command-49$/)).toBeVisible();
expect(within(records).queryByText("dev-turn-command-0")).not.toBeInTheDocument();
expect(within(records).queryByText("dev-turn-output-0")).not.toBeInTheDocument();
const [first] = within(records).getAllByRole("button", { name: "Run commands · Completed" });
expect(first).toHaveAttribute("aria-expanded", "false");
await user.click(first);
expect(within(records).getByText("dev-turn-command-0")).toBeVisible();
expect(within(records).queryByText("dev-turn-command-49")).not.toBeInTheDocument();
expect(screen.queryByText(/test-turn-command-0$/)).not.toBeInTheDocument();
await user.click(screen.getByRole("button", { name: "Expand all" }));
expect(within(records).getByText("dev-turn-output-0")).toBeVisible();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
memo,
useCallback,
useEffect,
useId,
useMemo,
useRef,
useState,
Expand Down Expand Up @@ -40,6 +41,7 @@ import {
Tooltip,
} from "@/components/ui";
import type { AgentLike } from "@/models/agents";
import { formatProgressToolDuration, isExecutionToolKind, progressToolStatus } from "@/models/turnProgress";
import {
isDirectConversation,
resolveUserByLocalIdentity,
Expand Down Expand Up @@ -820,14 +822,34 @@ function ActivityRow({
onCitationSelect?: CitationSelectHandler;
}) {
const [expanded, setExpanded] = useState(false);
const detailID = useId();
useEffect(() => {
if (expandAll !== undefined) setExpanded(expandAll || selected);
}, [expandAll, selected]);
const details = conversationActivityEntryDetails(entry, includeToolInput);
const hasDetail = details.length > 0;
const tool = includeToolInput ? entry.activity?.content.tool : undefined;
const tool = entry.activity?.content.tool;
const summary = conversationActivityEntrySummary(entry);
const rowSummary = tool?.title && !summary.startsWith(tool.title) ? `${tool.title} · ${summary}` : summary;
const isCommand = Boolean(entry.command) || isExecutionToolKind(tool?.kind) || isExecutionToolKind(tool?.title);
const actionKey = `progressAction_${isCommand ? "execute" : tool?.kind || "tool"}`;
const action = t(actionKey);
const name = details.some((detail) => detail.kind === "command") ? "" : tool?.title;
const toolTitle =
action === actionKey || (!isCommand && tool?.kind === "tool") ? name || t("progressAction_tool") : action;
const statusKey = tool ? `progressToolStatus_${progressToolStatus(tool.status, tool.exit_code)}` : "";
const status = statusKey ? t(statusKey) : "";
const duration = formatProgressToolDuration(tool?.duration_ms, t);
const rowSummary =
tool || isCommand
? [
toolTitle,
summary === toolTitle ? "" : summary,
status === statusKey ? "" : status,
duration ? t("progressToolDuration", { duration }) : "",
]
.filter(Boolean)
.join(" · ")
: summary;

return (
<article
Expand All @@ -842,8 +864,9 @@ function ActivityRow({
{hasDetail ? (
<button
type="button"
className={styles.rowSummary}
className={classNames(styles.rowSummary, (tool || isCommand) && styles.toolSummary)}
aria-expanded={expanded}
aria-controls={expanded ? detailID : undefined}
onClick={() => setExpanded((current) => !current)}
>
<ChevronRight className={expanded ? styles.expanded : undefined} aria-hidden="true" size={14} />
Expand All @@ -861,15 +884,9 @@ function ActivityRow({
) : null}
</div>
{hasDetail && expanded ? (
<div className={styles.detail}>
{tool ? (
<div className={styles.detail} id={detailID}>
{includeToolInput && tool && (tool.exit_code != null || tool.cwd) ? (
<div className={styles.toolFacts}>
<span>
{tool.title} · {tool.status}
</span>
{tool.duration_ms != null ? (
<span>{t("progressToolDuration", { seconds: (tool.duration_ms / 1000).toFixed(1) })}</span>
) : null}
{tool.exit_code != null ? <span>{t("progressExitCode", { code: tool.exit_code })}</span> : null}
{tool.cwd ? <span>{t("progressDirectory", { path: tool.cwd })}</span> : null}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ describe("conversation activity model", () => {
expect(entries.map((entry) => entry.eventType)).toEqual(["message", "message", "exec_command"]);
expect(conversationActivityEntrySummary(entries[0]!)).toBe("ship it");
expect(entries[2]).toMatchObject({ eventType: "exec_command", index: 3, updatedAt: "2026-07-16T10:00:05Z" });
expect(conversationActivityEntrySummary(entries[2]!)).toBe("npm run test:e2e");
expect(conversationActivityEntrySummary(entries[2]!)).toBe("");
expect(conversationActivityEntryDetails(entries[2]!)).toEqual([
{ kind: "command", value: "npm run test:e2e" },
{ kind: "result", value: "2 failed" },
Expand Down Expand Up @@ -304,7 +304,7 @@ describe("conversation activity model", () => {
expect(working?.activity).toEqual({ action: "preparing_reply" });
});

it("keeps the latest tool command visible while the runtime processes its result", () => {
it("summarizes the current action without exposing the command in the working dock", () => {
const roomAgents = conversationActivityAgents(room, agents);
const entries = conversationActivityEntries(
[
Expand Down Expand Up @@ -345,9 +345,9 @@ describe("conversation activity model", () => {

expect(working?.activity).toMatchObject({
action: "running",
summary: "csgclaw-cli participant list --channel csgclaw",
toolName: "exec_command",
summary: "",
});
expect(working?.activity?.toolName).toBeUndefined();
});

it("uses explicit work stages for model waits and final generation", () => {
Expand Down Expand Up @@ -398,21 +398,21 @@ describe("conversation activity model", () => {
expect(afterReply?.activity).toMatchObject({ action: "replying", summary: "Current answer" });
});

it("unwraps shell launchers and truncates long working summaries", () => {
it("truncates long targets in the compact working summary", () => {
const roomAgents = conversationActivityAgents(room, agents);
const command =
"printf 'a deliberately long command that should be shortened before it reaches the compact working status row'";
const query =
"a deliberately long search query that should be shortened before it reaches the compact working status row";
const entries = conversationActivityEntries(
[
toolMessage(
"dev-command",
"dev-search",
"2026-07-16T10:00:00Z",
{
input: { command: `/bin/zsh -lc "${command}"` },
kind: "exec_command",
input: { query },
kind: "web_search",
status: "running",
title: "Run shell command",
tool_call_id: "call-long-command",
title: "Search the web",
tool_call_id: "call-long-search",
},
"u-dev",
),
Expand All @@ -427,7 +427,6 @@ describe("conversation activity model", () => {
entries,
);

expect(working?.activity?.summary).not.toContain("/bin/zsh -lc");
expect(working?.activity?.summary?.length).toBeLessThanOrEqual(72);
expect(working?.activity?.summary).toMatch(/…$/);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expandProgressMessage, newerProgressMessage } from "@/models/turnProgress";
import { expandProgressMessage, isExecutionToolKind, newerProgressMessage } from "@/models/turnProgress";
import {
agentActivityMessageToolMergeKey,
agentActivityToolMergeKeys,
Expand Down Expand Up @@ -213,18 +213,20 @@ export function conversationActivityEntrySummary(entry: ConversationActivityEntr
return runtimeErrorDetail;
}
if (entry.command) {
return firstNonEmpty(entry.command.command, entry.command.title, entry.command.output);
return "";
}
const activity = entry.activity;
if (activity?.content.msgtype === AgentActivityMsgTypes.tool && activity.content.tool) {
const tool = activity.content.tool;
return firstNonEmpty(
toolCommandText(tool),
toolInputText(tool),
toolOutputText(tool),
tool.title,
activity.content.body,
if (isExecutionToolKind(tool.kind) || isExecutionToolKind(tool.title)) return "";
const command = toolCommandText(tool);
const fields = ["query", "q", "url", "path", "file"];
const summary = firstNonEmpty(
tool.progress_summary,
summaryValue(tool.input_summary, ...fields),
summaryValue(tool.input, ...fields),
);
return command && summary.includes(command) ? "" : summary;
}
if (activity?.content.msgtype === AgentActivityMsgTypes.action) {
const action = activity.content.action;
Expand Down Expand Up @@ -303,7 +305,7 @@ export function conversationWorkingParticipantsWithActivity(
action: conversationWorkingActionForEntry(entry),
entryID: entry.id,
summary: compactWorkingSummary(conversationActivityEntrySummary(entry)),
toolName: entry.tone === "tool" ? entry.eventType : undefined,
toolName: entry.tone === "tool" && !isExecutionToolKind(entry.eventType) ? entry.eventType : undefined,
updatedAt: entry.updatedAt || entry.createdAt,
},
},
Expand Down Expand Up @@ -767,9 +769,7 @@ function truncateText(value: string, maxLength: number): string {
}

function compactWorkingSummary(value: string): string {
const compact = value.replace(/\s+/g, " ").trim();
const shellCommand = compact.match(/^\/(?:usr\/)?bin\/(?:ba|z|)sh\s+-lc\s+(['"])(.*)\1$/)?.[2] || compact;
return truncateText(shellCommand, MAX_WORKING_SUMMARY_LENGTH);
return truncateText(value.replace(/\s+/g, " ").trim(), MAX_WORKING_SUMMARY_LENGTH);
}

function normalizeEventType(value: string): string {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import messageContentStyles from "./MessageContent.module.css";
import { useEffect, useMemo, useState } from "react";
import { Check, ShieldAlert, ShieldCheck, ShieldX, Wrench, X } from "lucide-react";
import { Check, ShieldAlert, ShieldCheck, ShieldX, X } from "lucide-react";
import { decideChannelActivity } from "@/api/agentActivities";
import { errorMessage } from "@/api/client";
import { AgentActivityMsgTypes } from "@/shared/constants/messages";
import { createTranslator } from "@/shared/i18n";
import { questionOptions } from "@/models/agentActivity";
import { ToolOutput } from "@/components/business/ToolOutput";
import { StandaloneToolStep } from "@/components/business/TurnProgress";
import { isExecutionToolKind } from "@/models/turnProgress";
import type {
AgentActivityAction,
AgentActivityActionOption,
Expand Down Expand Up @@ -99,21 +100,22 @@ function questionStatusLabel(status: string, t: TranslateFn): string {

function ToolActivityCard({ activity, t }: { activity: AgentActivityPayload; t: TranslateFn }) {
const tool = activity.content.tool!;
const summary = tool.output_summary || tool.input_summary || activity.content.body || "";
const label = t(tool.output_summary ? "progressOutput" : tool.input_summary ? "progressInput" : "progressToolList");
return <ToolActivityOutput name={displayToolKind(tool.kind)} label={label} text={summary} />;
}

export function ToolActivityOutput({ name, label, text }: { name: string; label: string; text: string }) {
return (
<section className={messageContentStyles.toolActivity}>
<div className={messageContentStyles.toolActivityHeading}>
<Wrench size={14} aria-hidden="true" />
<code title={name}>{name}</code>
<span>{label}</span>
</div>
{text ? <ToolOutput label={label} text={text} /> : null}
</section>
<StandaloneToolStep
tool={{
name: tool.title,
actions: tool.kind ? [isExecutionToolKind(tool.kind) ? "execute" : tool.kind] : [],
status: tool.status,
summary: tool.progress_summary,
command: tool.command,
cwd: tool.cwd,
input: tool.input_summary || activity.content.body,
output: tool.output_summary,
duration_ms: tool.duration_ms,
exit_code: tool.exit_code ?? undefined,
}}
t={t}
/>
);
}

Expand Down Expand Up @@ -256,13 +258,3 @@ function permissionActionOptionLabel(option: AgentActivityActionOption, t: Trans
return option.label || option.id || t("permissionAction");
}
}

function displayToolKind(kind: string | undefined) {
const normalized = String(kind || "")
.trim()
.toLowerCase();
if (normalized === "execute") {
return "exec";
}
return normalized || "tool";
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,32 @@
margin-bottom: 0;
}

.message-content[data-streaming-text] > :last-child:not(:is(ul, ol))::after,
.message-content[data-streaming-text] > :is(ul, ol):last-child > li:last-child::after {
content: "";
display: inline-block;
inline-size: 0.38em;
block-size: 0.9em;
margin-inline-start: 0.2em;
border-radius: 1px;
background: currentColor;
vertical-align: -0.08em;
animation: message-stream-caret 1s step-end infinite;
}

@keyframes message-stream-caret {
50% {
opacity: 0.2;
}
}

@media (prefers-reduced-motion: reduce) {
.message-content[data-streaming-text] > :last-child:not(:is(ul, ol))::after,
.message-content[data-streaming-text] > :is(ul, ol):last-child > li:last-child::after {
animation: none;
}
}

.message-citation-link {
display: inline;
margin: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,36 +189,3 @@
transform: translateY(-2px);
}
}

.toolActivity {
min-width: 0;
padding: 10px 12px;
border-radius: var(--radius-md);
background: var(--panel-strong);
}

.toolActivityHeading {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
margin-bottom: 6px;
color: var(--muted);
font: var(--text-xs-semibold);
}

.toolActivityHeading code {
min-width: 0;
overflow: hidden;
color: var(--text);
text-overflow: ellipsis;
white-space: nowrap;
}

:global(:root[data-theme]) :global(.message-row:not(.own)) :global(.message-bubble):has(.toolActivity),
:global(:root[data-theme]) :global(.thread-message) :global(.thread-message-bubble):has(.toolActivity) {
padding: 0;
border: 0;
background: transparent;
box-shadow: none;
}
Loading
Loading