summaryrefslogtreecommitdiffhomepage
path: root/src/features/chat/logic
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-10-15 08:59:06 +0900
committerAdam Malczewski <[email protected]>2026-10-15 08:59:06 +0900
commitd594de6934a4c5f20079b86f7a76b7f8ad0cb512 (patch)
tree6cda188268e6e7e68381ab0e1927c1c5c8a0dd6e /src/features/chat/logic
parentc38aba84b29f13c4d6ac940b47ce231e55b6558a (diff)
downloaddispatch-web-d594de6934a4c5f20079b86f7a76b7f8ad0cb512.tar.gz
dispatch-web-d594de6934a4c5f20079b86f7a76b7f8ad0cb512.zip
feat(tool-call-cards): final visual polish — unified edit diff, quiet failed/orphan/pending headers
Diffstat (limited to 'src/features/chat/logic')
-rw-r--r--src/features/chat/logic/tool-summary.test.ts14
-rw-r--r--src/features/chat/logic/tool-summary.ts4
2 files changed, 15 insertions, 3 deletions
diff --git a/src/features/chat/logic/tool-summary.test.ts b/src/features/chat/logic/tool-summary.test.ts
index 381842a..876ede2 100644
--- a/src/features/chat/logic/tool-summary.test.ts
+++ b/src/features/chat/logic/tool-summary.test.ts
@@ -85,6 +85,18 @@ describe("tool summaries", () => {
]);
expect(view("edit_file", { path: "a" }).callBadges).toEqual([]);
});
+ it("omits edit diffstats after failure while retaining attempted edits in call details", () => {
+ const input = { path: "src/missing.ts", oldString: "foo", newString: "bar" };
+ const card = view("edit_file", input, "Error: oldString not found", true);
+ expect(card.callBadges).toEqual([]);
+ expect(card.callDetail).toEqual({
+ kind: "edit",
+ path: input.path,
+ oldText: "foo",
+ newText: "bar",
+ });
+ expect(card.resultSummary).toBe("failed");
+ });
it("preserves exact shell commands in the expanded detail", () => {
expect(view("run_shell", { command: "ls\n pwd" }).callDetail).toEqual({
kind: "command",
@@ -228,7 +240,7 @@ describe("tool summaries", () => {
});
expect(viewToolEntry(e).callDetail).toEqual({
kind: "unavailable",
- text: "The call is in earlier, unloaded history. Its response is shown below.",
+ text: "This call is earlier in the conversation. Show earlier messages to see it.",
});
});
});
diff --git a/src/features/chat/logic/tool-summary.ts b/src/features/chat/logic/tool-summary.ts
index 2e7680c..3ea4a8e 100644
--- a/src/features/chat/logic/tool-summary.ts
+++ b/src/features/chat/logic/tool-summary.ts
@@ -251,7 +251,7 @@ export function viewToolEntry(entry: ToolEntry): ToolCardView {
? "Call in earlier history"
: oneLine(builtInSummary || generic || serialize(input));
const callBadges: ToolCardView["callBadges"][number][] = [];
- if (entry.toolName === "edit_file" && entry.call !== null) {
+ if (entry.toolName === "edit_file" && entry.call !== null && !entry.result?.isError) {
if (typeof args.oldString === "string" && typeof args.newString === "string") {
callBadges.push(
{ label: `+${lineCount(args.newString)}`, tone: "success" },
@@ -272,7 +272,7 @@ export function viewToolEntry(entry: ToolEntry): ToolCardView {
entry.call === null
? {
kind: "unavailable",
- text: "The call is in earlier, unloaded history. Its response is shown below.",
+ text: "This call is earlier in the conversation. Show earlier messages to see it.",
}
: detail(entry.toolName, input, args),
resultSummary,