Update files

This commit is contained in:
Mohamed Boudra
2026-02-08 21:12:40 +07:00
parent 925752c8a3
commit 8317b0d89b
11 changed files with 1391 additions and 407 deletions

View File

@@ -159,7 +159,11 @@ export function curateAgentActivity(
case "tool_call": {
flushBuffers(lines, buffers);
const inputJson = formatToolInputJson(item.input);
const { displayName, summary } = parseToolCallDisplay({ name: item.name, input: item.input, metadata: item.metadata });
const { displayName, summary } = parseToolCallDisplay({
name: item.name,
input: item.input,
metadata: item.metadata,
});
if (isLikelyExternalToolName(item.name) && inputJson) {
lines.push(`[${displayName}] ${inputJson}`);
break;

View File

@@ -98,6 +98,7 @@ describe("parseToolCallDisplay", () => {
describe("summary (was extractPrincipalParam)", () => {
test("extracts and strips shell wrapper from command string", () => {
const result = parseToolCallDisplay({
provider: "claude",
name: "Bash",
input: { command: "/bin/zsh -lc cd /Users/dev/project && npm run format" },
});
@@ -120,6 +121,14 @@ describe("parseToolCallDisplay", () => {
expect(result.summary).toBe("npm run build");
});
test("falls back to output command when shell input is missing", () => {
const result = parseToolCallDisplay({
name: "Bash",
output: { type: "command", command: "pwd", output: "/tmp" },
});
expect(result.summary).toBe("pwd");
});
test("extracts file_path and strips cwd", () => {
const result = parseToolCallDisplay({
name: "Read",
@@ -129,6 +138,34 @@ describe("parseToolCallDisplay", () => {
expect(result.summary).toBe("src/file.ts");
});
test("falls back to read output path when input is missing", () => {
const result = parseToolCallDisplay({
provider: "codex",
name: "Read",
output: {
type: "file_read",
filePath: "/Users/dev/project/src/file.ts",
content: "hello",
},
cwd: "/Users/dev/project",
});
expect(result.summary).toBe("src/file.ts");
});
test("falls back to edit output path when input is missing", () => {
const result = parseToolCallDisplay({
name: "Edit",
output: {
type: "file_edit",
filePath: "/Users/dev/project/src/file.ts",
oldContent: "a",
newContent: "b",
},
cwd: "/Users/dev/project",
});
expect(result.summary).toBe("src/file.ts");
});
test("extracts pattern without modification", () => {
const result = parseToolCallDisplay({
name: "Grep",
@@ -168,7 +205,7 @@ describe("parseToolCallDisplay", () => {
});
describe("summary from metadata", () => {
test("subAgentActivity in metadata takes priority over input", () => {
test("subAgentActivity in metadata takes priority for Task", () => {
const result = parseToolCallDisplay({
name: "Task",
input: { description: "Explore codebase" },
@@ -185,6 +222,15 @@ describe("parseToolCallDisplay", () => {
});
expect(result.summary).toBe("Bash");
});
test("non-Task tools keep their parsed summary even when metadata is present", () => {
const result = parseToolCallDisplay({
name: "Bash",
input: { command: "pwd" },
metadata: { subAgentActivity: "Read" },
});
expect(result.summary).toBe("pwd");
});
});
describe("kind", () => {

File diff suppressed because it is too large Load Diff