Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

feat(activity): show each Activity step's tool, outcome, and error

jeffrey31e1dbdacb9c
diff --git a/apps/computer/local-daemon/internal/provider/activity_input.go b/apps/computer/local-daemon/internal/provider/activity_input.go
index 617451e5..14a1f72a 100644
--- a/apps/computer/local-daemon/internal/provider/activity_input.go
+++ b/apps/computer/local-daemon/internal/provider/activity_input.go
@@ -8,9 +8,10 @@ import (
)
// Publish only fields used by the product's tool summaries, not message bodies,
-// environment maps, credentials, file contents, or full patches. The Room
-// status line's title and steps come first, so the size limit never drops
-// them.
+// environment maps, credentials, file contents, or full patches. Computer
+// tools publish their target and keys but never typed text, field values,
+// element tokens, or window ids. The Room status line's title and steps come
+// first, so the size limit never drops them.
func activityInput(input map[string]any, status activityStatus) []map[string]any {
if arguments, ok := input["arguments"].(map[string]any); ok {
input = arguments
@@ -45,7 +46,7 @@ func activityInput(input map[string]any, status activityStatus) []map[string]any
}
summary["status_steps"] = steps
}
- for _, key := range []string{"cmd", "command", "file_path", "path", "filename", "paths", "pattern", "query", "q", "url", "target", "recipient", "threadId", "thread_id", "room_id", "task_name", "agent_id", "duration_ms", "yield_time_ms", "plan", "steps"} {
+ for _, key := range []string{"cmd", "command", "file_path", "path", "filename", "paths", "pattern", "query", "q", "url", "target", "recipient", "threadId", "thread_id", "room_id", "task_name", "agent_id", "duration_ms", "yield_time_ms", "plan", "steps", "bundle_id", "urls", "name", "role", "direction", "key", "keys", "actions", "script"} {
value, ok := safe[key]
if !ok {
continue
@@ -57,10 +58,17 @@ func activityInput(input map[string]any, status activityStatus) []map[string]any
}
case float64, int, int64, json.Number:
case []any:
- // Keep public plan steps and file paths, without arbitrary nested data.
+ // Keep public plan steps, file paths, and batch steps' tool names,
+ // without arbitrary nested data such as typed text.
values := make([]any, 0, len(typed))
for _, entry := range typed {
- if key == "plan" || key == "steps" {
+ if key == "actions" {
+ if fields, ok := entry.(map[string]any); ok {
+ if tool, ok := fields["tool"].(string); ok {
+ values = append(values, tool)
+ }
+ }
+ } else if key == "plan" || key == "steps" {
step := map[string]any{}
if fields, ok := entry.(map[string]any); ok {
for _, name := range []string{"step", "status"} {
diff --git a/apps/computer/local-daemon/internal/provider/activity_input_test.go b/apps/computer/local-daemon/internal/provider/activity_input_test.go
index 06ad1d19..49b67308 100644
--- a/apps/computer/local-daemon/internal/provider/activity_input_test.go
+++ b/apps/computer/local-daemon/internal/provider/activity_input_test.go
@@ -26,6 +26,14 @@ func TestToolActivityPublishesDisplayInput(t *testing.T) {
{"view_image", "path", "preview.png"},
{"sleep", "duration_ms", float64(1000)},
{"update_plan", "plan", []any{map[string]any{"step": "Verify", "status": "pending"}}},
+ {"mcp__computer__launch_app", "bundle_id", "com.apple.TextEdit"},
+ {"mcp__computer__launch_app", "urls", []any{"https://www.example.com/"}},
+ {"mcp__computer__click", "role", "AXButton"},
+ {"mcp__computer__click", "name", "Save"},
+ {"mcp__computer__scroll", "direction", "down"},
+ {"mcp__computer__press_key", "key", "return"},
+ {"mcp__computer__hotkey", "keys", []any{"cmd", "s"}},
+ {"mcp__computer__run_script", "script", "tell application \"Finder\" to activate"},
} {
t.Run(tc.tool, func(t *testing.T) {
projection := eventProjection{operationID: "operation"}
@@ -99,3 +107,35 @@ func TestToolActivityUnwrapsMCPArgumentsAndPatchPaths(t *testing.T) {
t.Fatal("invented input for an empty summary")
}
}
+
+func TestComputerActivityInputKeepsTargetsAndDropsTypedText(t *testing.T) {
+ content := activityInput(map[string]any{
+ "pid": float64(42), "window_id": float64(7), "element_token": "private-token", "text": "private-text", "value": "private-value",
+ "actions": []any{
+ map[string]any{"tool": "click", "element_token": "private-token"},
+ map[string]any{"tool": "type_text", "text": "private-text"},
+ map[string]any{"tool": "press_key", "key": "return"},
+ },
+ }, activityStatus{})
+ if len(content) != 1 {
+ t.Fatal("batch input was lost")
+ }
+ var input map[string]any
+ if err := json.Unmarshal([]byte(content[0]["content"].(string)), &input); err != nil {
+ t.Fatal(err)
+ }
+ if !reflect.DeepEqual(input, map[string]any{"actions": []any{"click", "type_text", "press_key"}}) {
+ t.Fatalf("batch input published more than its step tools: %v", input)
+ }
+}
+
+func TestComputerActivityInputClipsScripts(t *testing.T) {
+ content := activityInput(map[string]any{"script": strings.Repeat("a", 2000)}, activityStatus{})
+ var input map[string]string
+ if err := json.Unmarshal([]byte(content[0]["content"].(string)), &input); err != nil {
+ t.Fatal(err)
+ }
+ if got := []rune(input["script"]); len(got) != 501 || got[500] != '…' {
+ t.Fatalf("script was not clipped to 500 runes: %d", len(got))
+ }
+}
diff --git a/apps/computer/local-daemon/internal/provider/event_projection.go b/apps/computer/local-daemon/internal/provider/event_projection.go
index 37a65647..219e38fc 100644
--- a/apps/computer/local-daemon/internal/provider/event_projection.go
+++ b/apps/computer/local-daemon/internal/provider/event_projection.go
@@ -1,6 +1,7 @@
package provider
import (
+ "encoding/json"
"regexp"
"strings"
"time"
@@ -144,12 +145,41 @@ func (projection *eventProjection) projectActivity(message native.Event) []any {
if event["is_error"] == true {
outcome = "failed"
}
- return []any{event, map[string]any{"type": "activity.finished", "activity_id": stableEventID("activity", projection.operationID+"\x00"+callID), "outcome": outcome}}
+ finished := map[string]any{"type": "activity.finished", "activity_id": stableEventID("activity", projection.operationID+"\x00"+callID), "outcome": outcome}
+ // A failure's text tells the user why the step failed. Successful
+ // outputs stay private: they can be whole files or accessibility trees.
+ if output, _ := event["output"].(string); outcome == "failed" {
+ if text := strings.TrimSpace(toolResultText(output)); text != "" {
+ finished["content"] = []map[string]any{{"label": "Error", "format": "text", "content": clip(redact.Text(text), 500)}}
+ }
+ }
+ return []any{event, finished}
}
}
return []any{event}
}
+// toolResultText reads a tool output as text. Claude reports a tool result as
+// raw JSON, either a string or a list of content blocks; other Runtimes report
+// plain text, which is returned unchanged.
+func toolResultText(output string) string {
+ var text string
+ if json.Unmarshal([]byte(output), &text) == nil {
+ return text
+ }
+ var blocks []struct{ Type, Text string }
+ if json.Unmarshal([]byte(output), &blocks) != nil {
+ return output
+ }
+ parts := make([]string, 0, len(blocks))
+ for _, block := range blocks {
+ if block.Type == "text" && block.Text != "" {
+ parts = append(parts, block.Text)
+ }
+ }
+ return strings.Join(parts, "\n")
+}
+
// gatewayID is the Runner Gateway Id format; a native identifier outside it
// is left out of a model record rather than failing the event.
var gatewayID = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$`)
diff --git a/apps/computer/local-daemon/internal/provider/events_regression_test.go b/apps/computer/local-daemon/internal/provider/events_regression_test.go
index 7e3cec91..92a6f25d 100644
--- a/apps/computer/local-daemon/internal/provider/events_regression_test.go
+++ b/apps/computer/local-daemon/internal/provider/events_regression_test.go
@@ -39,6 +39,35 @@ func TestEventProjectionPreservesToolIdentityAndActivityOutcome(t *testing.T) {
}
}
+func TestFailedActivityPublishesItsRedactedError(t *testing.T) {
+ finish := func(status, output string) map[string]any {
+ projection := eventProjection{operationID: "operation"}
+ projection.project(native.Event{Kind: native.EventToolCall, InvocationID: "tool-1", ToolName: "mcp__computer__press_key"})
+ events := projection.project(native.Event{Kind: native.EventToolOutput, InvocationID: "tool-1", Status: status, Output: output})
+ return events[len(events)-1].(map[string]any)
+ }
+ for _, output := range []string{
+ "COMPUTER_KEYS_REFUSED: no window",
+ `"COMPUTER_KEYS_REFUSED: no window"`,
+ `[{"type":"text","text":"COMPUTER_KEYS_REFUSED: no window"},{"type":"image","data":"private-image"}]`,
+ } {
+ content, _ := finish("failed", output)["content"].([]map[string]any)
+ if len(content) != 1 || content[0]["label"] != "Error" || content[0]["format"] != "text" || content[0]["content"] != "COMPUTER_KEYS_REFUSED: no window" {
+ t.Fatalf("failed step lost its error for %s: %v", output, content)
+ }
+ }
+ content, _ := finish("failed", "Authorization: Bearer private-value "+strings.Repeat("é", 1000))["content"].([]map[string]any)
+ text, _ := content[0]["content"].(string)
+ if strings.Contains(text, "private-value") || utf8.RuneCountInString(text) > 500 {
+ t.Fatalf("error text was not redacted and clipped: %d runes", utf8.RuneCountInString(text))
+ }
+ for _, event := range []map[string]any{finish("completed", "whole accessibility tree"), finish("failed", " "), finish("failed", "[]")} {
+ if _, ok := event["content"]; ok {
+ t.Fatalf("published content without an error text: %v", event)
+ }
+ }
+}
+
func TestEventProjectionSplitsLongUnicodeRepliesWithoutLosingContent(t *testing.T) {
projection := eventProjection{operationID: "operation"}
content := strings.Repeat("\u4e2d", 100_000)
diff --git a/apps/web/src/features/rooms/runtime-status/runtime-activity-entries.tsx b/apps/web/src/features/rooms/runtime-status/runtime-activity-entries.tsx
index 03495925..3ce0d789 100644
--- a/apps/web/src/features/rooms/runtime-status/runtime-activity-entries.tsx
+++ b/apps/web/src/features/rooms/runtime-status/runtime-activity-entries.tsx
@@ -1,18 +1,52 @@
import type {
RuntimeActivityContentBlock,
RuntimeActivityEntry,
+ RuntimeActivityPresentation,
} from "./runtime-presentation-events";
+const outcomeLabels: Record<
+ NonNullable<RuntimeActivityPresentation["outcome"]>,
+ string
+> = {
+ canceled: "Canceled",
+ declined: "Declined",
+ failed: "Failed",
+ succeeded: "Succeeded",
+};
+
+/**
+ * One step's details: the tool the Runtime called, how it ended once it has,
+ * and the public blocks the Computer published for it.
+ */
export function RuntimeActivityEntries({
entries,
+ outcome,
title,
+ tool,
}: {
entries: readonly RuntimeActivityEntry[];
+ outcome?: RuntimeActivityPresentation["outcome"];
title: string;
+ tool: string;
}) {
- if (entries.length === 0) return null;
return (
<div aria-label={`${title} details`} className="mt-1.5 space-y-1.5">
+ <dl className="grid grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-0.5 text-[12px] leading-4">
+ <dt className="text-app-subtle">Tool</dt>
+ <dd className="break-all font-mono text-app-body">{tool}</dd>
+ {outcome ? (
+ <>
+ <dt className="text-app-subtle">Outcome</dt>
+ <dd
+ className={
+ outcome === "failed" ? "text-app-danger" : "text-app-body"
+ }
+ >
+ {outcomeLabels[outcome]}
+ </dd>
+ </>
+ ) : null}
+ </dl>
{entries.map((entry, index) =>
entry.type === "content" ? (
<RuntimeActivityContentBlockView
diff --git a/apps/web/src/features/rooms/runtime-status/runtime-activity-path-view.tsx b/apps/web/src/features/rooms/runtime-status/runtime-activity-path-view.tsx
index 72fdceb8..dd64f671 100644
--- a/apps/web/src/features/rooms/runtime-status/runtime-activity-path-view.tsx
+++ b/apps/web/src/features/rooms/runtime-status/runtime-activity-path-view.tsx
@@ -184,7 +184,7 @@ function activityItemLabel(item: RuntimeActivityPathItem): string {
}
if (item.kind === "tool_calls") {
return toolGroupPresentation(
- item.calls.map((call) => toolPresentation(call.kind)),
+ item.calls.map((call) => toolPresentation(call.kind, call.name)),
).label;
}
if (item.kind === "reply") return "Prepared a reply";
@@ -220,7 +220,9 @@ function RuntimeActivityPathRow({ item }: { item: RuntimeActivityPathItem }) {
unconfirmed={item.unconfirmed}
entries={item.entries}
icon={presentation.glyph}
+ outcome={item.outcome}
summary={presentation.summary}
+ tool={item.title}
/>
);
}
@@ -232,7 +234,9 @@ function RuntimeActivityPathRow({ item }: { item: RuntimeActivityPathItem }) {
unconfirmed={item.unconfirmed}
entries={item.entries}
icon={presentation.glyph}
+ outcome={item.outcome}
summary={presentation.summary}
+ tool={item.title}
/>
);
}
@@ -259,51 +263,46 @@ function ActivitySummaryRow({
unconfirmed,
entries,
icon,
+ outcome,
summary,
+ tool,
}: {
active: boolean;
unconfirmed?: boolean;
entries: RuntimeActivityPathToolCall["entries"];
icon: IconSvgElement;
+ outcome: RuntimeActivityPathToolCall["outcome"];
summary: string;
+ tool: string;
}) {
- const line = (
- <>
- <Icon className="shrink-0" icon={icon} size={14} />
- <span
- className={`min-w-0 flex-1 truncate ${active ? "town-shimmer-text" : ""}`}
- title={summary}
- >
- {summary}
- </span>
- {active ? <ActiveMark /> : null}
- {unconfirmed ? (
- <span className="text-[10px] text-app-muted">Unconfirmed</span>
- ) : null}
- {entries.length > 0 ? (
- <Icon
- icon={ArrowRight01Icon}
- className="shrink-0 transition-transform group-open:rotate-90 motion-reduce:transition-none"
- size={14}
- />
- ) : null}
- </>
- );
- if (entries.length === 0) {
- return (
- <li className="runtime-activity-step flex min-h-8 items-center gap-2 py-1.5">
- {line}
- </li>
- );
- }
return (
<li className="runtime-activity-step">
<details className="group">
<summary className="flex min-h-8 cursor-pointer list-none items-center gap-2 py-1.5 hover:text-app-body focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-app-focus [&::-webkit-details-marker]:hidden">
- {line}
+ <Icon className="shrink-0" icon={icon} size={14} />
+ <span
+ className={`min-w-0 flex-1 truncate ${active ? "town-shimmer-text" : ""}`}
+ title={summary}
+ >
+ {summary}
+ </span>
+ {active ? <ActiveMark /> : null}
+ {unconfirmed ? (
+ <span className="text-[10px] text-app-muted">Unconfirmed</span>
+ ) : null}
+ <Icon
+ icon={ArrowRight01Icon}
+ className="shrink-0 transition-transform group-open:rotate-90 motion-reduce:transition-none"
+ size={14}
+ />
</summary>
<div className="pb-2 pl-[1.45rem]">
- <RuntimeActivityEntries entries={entries} title={summary} />
+ <RuntimeActivityEntries
+ entries={entries}
+ outcome={outcome}
+ title={summary}
+ tool={tool}
+ />
</div>
</details>
</li>
@@ -319,7 +318,7 @@ function ToolCallsRow({
const presentedCalls = calls.map((call) => {
return {
...call,
- ...toolPresentation(call.kind),
+ ...toolPresentation(call.kind, call.name),
};
});
const { glyph: groupGlyph, label } = toolGroupPresentation(presentedCalls);
@@ -373,13 +372,6 @@ function ToolCallsRow({
) : null}
</>
);
- if (call.entries.length === 0) {
- return (
- <li className="flex min-h-7 items-center gap-2" key={call.id}>
- {name}
- </li>
- );
- }
return (
<li className="min-w-0" key={call.id}>
<details className="group/tool">
@@ -388,7 +380,9 @@ function ToolCallsRow({
</summary>
<RuntimeActivityEntries
entries={call.entries}
+ outcome={call.outcome}
title={`${label}: ${call.name}`}
+ tool={call.name}
/>
</details>
</li>
diff --git a/apps/web/src/features/rooms/runtime-status/runtime-activity-path.test.tsx b/apps/web/src/features/rooms/runtime-status/runtime-activity-path.test.tsx
index fcb866d7..291d6907 100644
--- a/apps/web/src/features/rooms/runtime-status/runtime-activity-path.test.tsx
+++ b/apps/web/src/features/rooms/runtime-status/runtime-activity-path.test.tsx
@@ -134,13 +134,13 @@ describe("Runtime activity path", () => {
record("3", {
activity_id: "command-1",
kind: "command",
- title: "Running a command",
+ title: "exec_command",
type: "activity.started",
}),
record("4", {
activity_id: "command-2",
kind: "command",
- title: "Running a command",
+ title: "exec_command",
type: "activity.started",
}),
record("5", {
@@ -243,10 +243,12 @@ describe("Runtime activity path", () => {
const group = screen.getAllByText("Running a command")[0]!;
expect(group).toBeVisible();
const technicalCommand = screen.getByText(/git status --short/);
+ const tool = screen.getByText(title, { selector: "dd" });
expect(technicalCommand).not.toBeVisible();
+ expect(tool).not.toBeVisible();
fireEvent.click(group);
expect(technicalCommand).toBeVisible();
- expect(screen.queryByText("exec_command")).not.toBeInTheDocument();
+ expect(tool).toBeVisible();
},
);
@@ -406,7 +408,7 @@ describe("Runtime activity path", () => {
},
],
kind: "command",
- title: "Running a command",
+ title: "exec_command",
}),
record("3", {
type: "activity.started",
@@ -442,18 +444,104 @@ describe("Runtime activity path", () => {
expect(screen.queryByText("Thinking")).not.toBeInTheDocument();
fireEvent.click(screen.getByText("Working through 2 steps"));
- expect(screen.getAllByText("Working on the task")).toHaveLength(2);
+ expect(screen.getByText("Get room")).toBeVisible();
+ expect(screen.getByText("List members")).toBeVisible();
+ expect(screen.queryByText("Working on the task")).not.toBeInTheDocument();
expect(screen.getByText("Input").closest("details")).not.toHaveAttribute(
"open",
);
- fireEvent.click(screen.getAllByText("Working on the task")[0]!);
+ fireEvent.click(screen.getByText("Get room"));
expect(screen.getByText("Input").closest("details")).toHaveAttribute(
"open",
"",
);
});
+ it("opens a step without published content to show its tool and outcome", () => {
+ render(
+ <RuntimeActivityPath
+ records={[
+ record("1", {
+ type: "activity.started",
+ activity_id: "launch",
+ kind: "tool",
+ title: "mcp__computer__launch_app",
+ }),
+ record("2", {
+ type: "activity.finished",
+ activity_id: "launch",
+ outcome: "failed",
+ }),
+ record("3", {
+ type: "activity.started",
+ activity_id: "read",
+ kind: "tool",
+ title: "mcp__computer__get_window_state",
+ }),
+ ]}
+ />,
+ );
+
+ fireEvent.click(screen.getByText("Working through 2 steps"));
+ const step = screen.getByText("Launch app");
+ const tool = screen.getByText("mcp__computer__launch_app");
+ expect(tool).not.toBeVisible();
+ fireEvent.click(step);
+ expect(step.closest("details")).toHaveAttribute("open", "");
+ expect(tool).toBeVisible();
+ expect(screen.getByText("Failed")).toBeVisible();
+
+ fireEvent.click(screen.getByText("Get window state"));
+ expect(screen.getByText("mcp__computer__get_window_state")).toBeVisible();
+ expect(screen.getAllByText("Outcome")).toHaveLength(1);
+ });
+
+ it("shows a failed step's error after its input", () => {
+ render(
+ <RuntimeActivityPath
+ records={[
+ record("1", {
+ type: "activity.started",
+ activity_id: "key",
+ kind: "tool",
+ title: "mcp__computer__press_key",
+ content: [
+ {
+ content: JSON.stringify({ key: "return" }),
+ format: "json",
+ label: "Input",
+ },
+ ],
+ }),
+ record("2", {
+ type: "activity.finished",
+ activity_id: "key",
+ outcome: "failed",
+ content: [
+ {
+ content: "COMPUTER_KEYS_REFUSED: no focused window",
+ format: "text",
+ label: "Error",
+ },
+ ],
+ }),
+ ]}
+ />,
+ );
+
+ const [group, step] = screen.getAllByText("Press key");
+ fireEvent.click(group!);
+ fireEvent.click(step!);
+ const details = screen.getByLabelText(
+ "Tool: mcp__computer__press_key details",
+ );
+ expect(details).toBeVisible();
+ expect(details.textContent).toMatch(
+ /mcp__computer__press_key.*Failed.*Input.*return.*Error.*COMPUTER_KEYS_REFUSED: no focused window/,
+ );
+ });
+
it("folds long thinking and keeps replies collapsed until selected", async () => {
const title = "Synthesize a six-week launch plan. ".repeat(4).trim();
const reply = "Final conclusion.".repeat(40);
@@ -679,6 +767,7 @@ describe("Runtime activity path", () => {
key: "command-1",
kind: "command",
name: "/bin/zsh -lc 'cat .agents/skills/agent-worker/SKILL.md'",
+ title: "Running a command",
},
{
active: true,
@@ -695,6 +784,7 @@ describe("Runtime activity path", () => {
key: "command-2",
kind: "command",
name: "/bin/zsh -lc 'cat playground/agent.json'",
+ title: "Running a command",
},
{
active: false,
@@ -818,6 +908,7 @@ describe("Runtime activity path", () => {
kind: "command",
name: "pwd",
outcome: "succeeded",
+ title: "Running a command",
},
{
calls: [
diff --git a/apps/web/src/features/rooms/runtime-status/runtime-activity-path.ts b/apps/web/src/features/rooms/runtime-status/runtime-activity-path.ts
index dda10c52..3bd3200c 100644
--- a/apps/web/src/features/rooms/runtime-status/runtime-activity-path.ts
+++ b/apps/web/src/features/rooms/runtime-status/runtime-activity-path.ts
@@ -30,6 +30,7 @@ export type RuntimeActivityPathItem =
kind: "command";
name: string;
outcome?: ActivityOutcome;
+ title: string;
unconfirmed?: boolean;
}
| {
@@ -262,6 +263,7 @@ function pushActivity(
key: activity.activityId,
kind: "command",
name: commandSummary(activity),
+ title: activity.title,
...(activity.outcome === undefined ? {} : { outcome: activity.outcome }),
});
return;
diff --git a/apps/web/src/features/rooms/runtime-status/runtime-tool-presentation.test.ts b/apps/web/src/features/rooms/runtime-status/runtime-tool-presentation.test.ts
index 2bc769aa..0ffdd919 100644
--- a/apps/web/src/features/rooms/runtime-status/runtime-tool-presentation.test.ts
+++ b/apps/web/src/features/rooms/runtime-status/runtime-tool-presentation.test.ts
@@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";
import {
activityStatusLine,
toolGroupPresentation,
+ toolNameLabel,
toolPresentation,
} from "./runtime-tool-presentation";
@@ -28,6 +29,23 @@ describe("toolPresentation", () => {
expect(toolPresentation("tool").summary).toBe("Working on the task");
});
+ it("labels a generic tool call by its tool name", () => {
+ expect(
+ toolPresentation("tool", "mcp__computer__get_window_state").summary,
+ ).toBe("Get window state");
+ expect(toolPresentation("tool", "Skill").summary).toBe("Skill");
+ expect(toolPresentation("unknown_kind", "run_script").summary).toBe(
+ "Run script",
+ );
+ expect(toolPresentation("read", "mcp__computer__read").summary).toBe(
+ "Reviewing files",
+ );
+ expect(toolNameLabel("mcp__teamhub__send_message")).toBe("Send message");
+ expect(
+ toolGroupPresentation([toolPresentation("tool", "Skill")]).label,
+ ).toBe("Skill");
+ });
+
it("summarizes mixed or unknown operations as user-facing steps", () => {
expect(
toolGroupPresentation(
diff --git a/apps/web/src/features/rooms/runtime-status/runtime-tool-presentation.ts b/apps/web/src/features/rooms/runtime-status/runtime-tool-presentation.ts
index f2b23a67..89d46662 100644
--- a/apps/web/src/features/rooms/runtime-status/runtime-tool-presentation.ts
+++ b/apps/web/src/features/rooms/runtime-status/runtime-tool-presentation.ts
@@ -75,9 +75,30 @@ const kinds: Record<string, ToolCategory> = {
tool: "tool",
};
-export function toolPresentation(kind: string) {
+/**
+ * How a tool call is shown. A call of the generic kind says nothing on its
+ * own, so its tool name labels it when one is known.
+ */
+export function toolPresentation(kind: string, name?: string) {
const category = kinds[kind] ?? "tool";
- return { category, ...presentations[category], summary: summaries[category] };
+ const named = category === "tool" && name ? toolNameLabel(name) : "";
+ return {
+ category,
+ ...presentations[category],
+ summary: named || summaries[category],
+ };
+}
+
+/**
+ * A tool name as words, without an MCP server prefix:
+ * `mcp__computer__get_window_state` reads "Get window state".
+ */
+export function toolNameLabel(name: string) {
+ const tool = name.startsWith("mcp__")
+ ? name.slice(name.lastIndexOf("__") + 2)
+ : name;
+ const words = tool.replaceAll("_", " ").trim();
+ return words ? words.charAt(0).toUpperCase() + words.slice(1) : name;
}
const summaries: Record<ToolCategory, string> = {
diff --git a/apps/web/src/features/rooms/task-sidebar/adapters/message-activities-panel-tab.test.tsx b/apps/web/src/features/rooms/task-sidebar/adapters/message-activities-panel-tab.test.tsx
index 04919ab2..8bbc9f4e 100644
--- a/apps/web/src/features/rooms/task-sidebar/adapters/message-activities-panel-tab.test.tsx
+++ b/apps/web/src/features/rooms/task-sidebar/adapters/message-activities-panel-tab.test.tsx
@@ -81,9 +81,7 @@ describe("MessageActivitiesPanelTab", () => {
</QueryClientProvider>,
);
- expect(
- (await screen.findAllByText("Working on the task"))[0],
- ).toBeVisible();
+ expect((await screen.findAllByText("Get room"))[0]).toBeVisible();
expect(
screen.queryByText("Tool result · get_room"),
).not.toBeInTheDocument();
diff --git a/apps/web/src/features/rooms/task-sidebar/adapters/runtime-history-view.test.tsx b/apps/web/src/features/rooms/task-sidebar/adapters/runtime-history-view.test.tsx
index 01f05d21..a3f81fb1 100644
--- a/apps/web/src/features/rooms/task-sidebar/adapters/runtime-history-view.test.tsx
+++ b/apps/web/src/features/rooms/task-sidebar/adapters/runtime-history-view.test.tsx
@@ -136,7 +136,7 @@ describe("RuntimeHistoryView", () => {
]}
/>,
);
- fireEvent.click(screen.getByText("Working on the task"));
+ fireEvent.click(screen.getByText("Exec command"));
expect(screen.getByText("exec_command")).toBeVisible();
expect(screen.queryByText(/README/)).not.toBeInTheDocument();
});
diff --git a/apps/web/src/features/rooms/task-sidebar/adapters/runtime-history-view.tsx b/apps/web/src/features/rooms/task-sidebar/adapters/runtime-history-view.tsx
index 6bd7aad8..06de2a35 100644
--- a/apps/web/src/features/rooms/task-sidebar/adapters/runtime-history-view.tsx
+++ b/apps/web/src/features/rooms/task-sidebar/adapters/runtime-history-view.tsx
@@ -3,6 +3,7 @@ import { useMemo } from "react";
import {
toolGroupPresentation,
+ toolNameLabel,
toolPresentation,
} from "@/features/rooms/runtime-status/runtime-tool-presentation";
@@ -70,10 +71,7 @@ function activityTimelineItems(
record = {
...record,
category: "tool_call",
- tool_name:
- stringValue(invocation?.tool)
- ?.replaceAll("_", " ")
- .replace(/^./, (letter) => letter.toUpperCase()) ?? "Tool call",
+ tool_name: toolNameLabel(stringValue(invocation?.tool) ?? "Tool call"),
};
} else if (record.category === "tool_call") {
if (record.tool_name === "exec") continue;
@@ -122,10 +120,11 @@ function RuntimeToolCallsActivity({ calls }: { calls: ActivityToolCall[] }) {
const name = record.tool_name ?? pair?.call?.tool_name ?? "Tool call";
const invocation = asObject(nativePayload(record)?.invocation);
// Native history carries tool names, not activity kinds: show the name.
+ const shownName = stringValue(invocation?.tool) ?? name;
return {
record,
- name: stringValue(invocation?.tool) ?? name,
- ...toolPresentation("tool"),
+ name: shownName,
+ ...toolPresentation("tool", shownName),
};
});
const { icon: GroupIcon, label: groupLabel } =