MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / performRewind

Method performRewind

src/core/message-manager/index.ts:78–89  ·  view source on GitHub ↗

* Internal method that performs the actual rewind operation.

(toIndex: number, cutoffTs: number, options: RewindOptions)

Source from the content-addressed store, hash-verified

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

Callers 2

rewindToTimestampMethod · 0.95
rewindToIndexMethod · 0.95

Tested by

no test coverage detected