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

Method rewindToTimestamp

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

* Rewind conversation to a specific timestamp. * This is the SINGLE entry point for all message deletion operations. * * @param ts - The timestamp to rewind to * @param options - Rewind options * @throws Error if timestamp not found in clineMessages

(ts: number, options: RewindOptions = {})

Source from the content-addressed store, hash-verified

46 * @throws Error if timestamp not found in clineMessages
47 */
48 async rewindToTimestamp(ts: number, options: RewindOptions = {}): Promise<void> {
49 const { includeTargetMessage = false, skipCleanup = false } = options
50
51 // Find the index in clineMessages
52 const clineIndex = this.task.clineMessages.findIndex((m) => m.ts === ts)
53 if (clineIndex === -1) {
54 throw new Error(`Message with timestamp ${ts} not found in clineMessages`)
55 }
56
57 // Calculate the actual cutoff index
58 const cutoffIndex = includeTargetMessage ? clineIndex + 1 : clineIndex
59
60 await this.performRewind(cutoffIndex, ts, { skipCleanup })
61 }
62
63 /**
64 * Rewind conversation to a specific index in clineMessages.

Callers 4

checkpointRestoreFunction · 0.80
index.spec.tsFile · 0.80
handleEditMessageConfirmFunction · 0.80

Calls 1

performRewindMethod · 0.95

Tested by

no test coverage detected