* Internal method that performs the actual rewind operation.
(toIndex: number, cutoffTs: number, options: RewindOptions)
| 76 | * Internal method that performs the actual rewind operation. |
| 77 | */ |
| 78 | private async performRewind(toIndex: number, cutoffTs: number, options: RewindOptions): Promise<void> { |
| 79 | const { skipCleanup = false } = options |
| 80 | |
| 81 | // Step 1: Collect context event IDs from messages being removed |
| 82 | const removedIds = this.collectRemovedContextEventIds(toIndex) |
| 83 | |
| 84 | // Step 2: Truncate clineMessages |
| 85 | await this.truncateClineMessages(toIndex) |
| 86 | |
| 87 | // Step 3: Truncate and clean API history (combined with cleanup for efficiency) |
| 88 | await this.truncateApiHistoryWithCleanup(cutoffTs, removedIds, skipCleanup) |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * Collect condenseIds and truncationIds from context-management events |
no test coverage detected