165
// Remove old path mapping (the file no longer exists at that path)
166
pathToIdentityKey.delete(edit.originalPath);
168
>
// Regular edit, create, or delete: look up or create identity
169
>
identityKey = pathToIdentityKey.get(edit.filePath) ?? edit.filePath;
170
>
pathToIdentityKey.set(edit.filePath, identityKey);
171
>
}
172
>
173
>
if (touchedIdentityKeys && edit.turnId === incremental.changedTurnId) {
174
touchedIdentityKeys.add(identityKey);
175
}
177
>
const existing = identities.get(identityKey);
178
>
if (!existing) {
179
>
// First time seeing this file identity
180
>
identities.set(identityKey, {
181
>
terminalPath: edit.filePath,
182
>
firstToolCallId: edit.toolCallId,
183
>
firstFilePath: edit.kind === FileEditKind.Rename && edit.originalPath ? edit.originalPath : edit.filePath,
184
>
firstKind: edit.kind,
185
>
firstSourceIdx: 0,
186
>
lastToolCallId: edit.toolCallId,
187
>
lastFilePath: edit.filePath,
188
>
lastKind: edit.kind,
189
>
lastSourceIdx: 0,
190
>
});
191
>
} else {
192
// Update last snapshot info and terminal path
193
existing.terminalPath = edit.filePath;