Skip to content
Merged
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 @@ -481,7 +481,7 @@ describe("chatPaneSelectors", () => {
expect(selectActiveSubAgentParentItemIds(state, "t1")).toEqual(["sub:run-1"]);
});

it("groups edits only with edits to the same file", () => {
it("groups adjacent edits with the rest of the tool-call run", () => {
const state = {
runtimeItemIdsByThread: {
t1: [
Expand Down Expand Up @@ -572,20 +572,18 @@ describe("chatPaneSelectors", () => {
{
kind: "tool_call_group",
id: "tool-call-group:edit-1",
itemIds: ["edit-1", "edit-2"],
itemIds: ["edit-1", "edit-2", "command-1", "command-2"],
},
{ kind: "item", id: "assistant-2" },
{
kind: "tool_call_group",
id: "tool-call-group:command-1",
itemIds: ["command-1", "command-2"],
id: "tool-call-group:edit-3",
itemIds: ["edit-3", "edit-4"],
},
{ kind: "item", id: "assistant-2" },
{ kind: "item", id: "edit-3" },
{ kind: "item", id: "edit-4" },
]);
});

it("applies the same edit grouping rule to generic edit tool calls", () => {
it("groups generic edit tool calls with adjacent tools", () => {
const state = {
runtimeItemIdsByThread: {
t1: ["tool-edit-1", "tool-edit-2", "tool-read-1", "tool-edit-3"],
Expand Down Expand Up @@ -643,10 +641,8 @@ describe("chatPaneSelectors", () => {
{
kind: "tool_call_group",
id: "tool-call-group:tool-edit-1",
itemIds: ["tool-edit-1", "tool-edit-2"],
itemIds: ["tool-edit-1", "tool-edit-2", "tool-read-1", "tool-edit-3"],
},
{ kind: "item", id: "tool-read-1" },
{ kind: "item", id: "tool-edit-3" },
]);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type {
} from "@/renderer/state/slices/runtimeEventSlice";
import type { AppStoreState } from "@/renderer/state/slices/shared";
import type { ToolCallPayload } from "@/shared/contracts";
import { canShareRuntimeToolGroup } from "@/renderer/state/runtimeToolGrouping";
import { imageViewRendersInline } from "./parts/items/imageViewSource";
import {
isToolGroupItem as isGroupableItemType,
Expand Down Expand Up @@ -159,9 +158,6 @@ function buildTimelineEntries(
if (!next || !isToolGroupItem(next) || childParentIds.has(nextId)) {
break;
}
if (!canShareRuntimeToolGroup(item, next)) {
break;
}
groupIds.push(nextId);
idx += 1;
}
Expand Down
20 changes: 7 additions & 13 deletions src/renderer/state/chatRuntimePersister.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe("prepareRuntimeSnapshotForPersistence", () => {
]);
});

it("does not compact edits together with other tool calls", () => {
it("compacts edits together with the rest of the tool-call run", () => {
const snapshot = prepareRuntimeSnapshotForPersistence(
[
makeItem({ id: "assistant-1", type: "assistant_message" }),
Expand Down Expand Up @@ -130,19 +130,13 @@ describe("prepareRuntimeSnapshotForPersistence", () => {
[makeTurn("edit-1"), makeTurn("edit-2"), makeTurn("command-1"), makeTurn("edit-3")],
);

const editSummaryId = "tool-call-summary:edit-1:edit-2:2";
const commandSummaryId = "tool-call-summary:command-1:command-2:2";
expect(snapshot.items.map((item) => item.id)).toEqual([
"assistant-1",
editSummaryId,
commandSummaryId,
"edit-3",
]);
const summaryId = "tool-call-summary:edit-1:edit-3:5";
expect(snapshot.items.map((item) => item.id)).toEqual(["assistant-1", summaryId]);
expect(snapshot.turns.map((turn) => turn.anchorItemId)).toEqual([
editSummaryId,
editSummaryId,
commandSummaryId,
"edit-3",
summaryId,
summaryId,
summaryId,
summaryId,
]);
});

Expand Down
2 changes: 0 additions & 2 deletions src/renderer/state/chatRuntimePersister.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { imageViewRendersInline } from "../components/thread/ChatPane/parts/item
import { isSubAgentTool } from "../components/thread/ChatPane/parts/items/toolDisplay";
import { readBridge } from "../bridge";
import { useAppStore } from "./appStore";
import { canShareRuntimeToolGroup } from "./runtimeToolGrouping";
import {
subscribeRuntimePersistenceDirtyThreads,
type CompletedTurnRecord,
Expand Down Expand Up @@ -272,7 +271,6 @@ function compactRuntimeItemsForPersistence(
while (idx < items.length) {
const next = items[idx]!;
if (!isToolGroupItem(next) || next.state !== "completed") break;
if (!canShareRuntimeToolGroup(run[0]!, next)) break;
run.push(next);
idx += 1;
}
Expand Down
123 changes: 0 additions & 123 deletions src/renderer/state/runtimeToolGrouping.ts

This file was deleted.