300
for (let sourceIdx = 0; sourceIdx < perSourceEdits.length; sourceIdx++) {
301
for (const edit of perSourceEdits[sourceIdx]) {
303
>
let identityKey: string;
304
>
305
>
if (edit.kind === FileEditKind.Rename && edit.originalPath) {
306
identityKey = pathToIdentityKey.get(edit.originalPath) ?? edit.originalPath;
307
pathToIdentityKey.set(edit.filePath, identityKey);
308
pathToIdentityKey.delete(edit.originalPath);
310
>
identityKey = pathToIdentityKey.get(edit.filePath) ?? edit.filePath;
311
>
pathToIdentityKey.set(edit.filePath, identityKey);
312
>
}
313
>
314
>
const existing = identities.get(identityKey);
315
>
if (!existing) {
316
>
identities.set(identityKey, {
317
>
terminalPath: edit.filePath,
318
>
firstToolCallId: edit.toolCallId,
319
>
firstFilePath: edit.kind === FileEditKind.Rename && edit.originalPath ? edit.originalPath : edit.filePath,
320
>
firstKind: edit.kind,
321
>
firstSourceIdx: sourceIdx,
322
>
lastToolCallId: edit.toolCallId,
323
>
lastFilePath: edit.filePath,
324
>
lastKind: edit.kind,
325
>
lastSourceIdx: sourceIdx,
326
>
});
327
>
} else {
328
existing.terminalPath = edit.filePath;
329
existing.lastToolCallId = edit.toolCallId;