conductor(checkpoint): Checkpoint end of Phase 4 - UI Features & History List

This commit is contained in:
2026-05-05 17:50:55 -04:00
parent b3c28a0697
commit 446a58717e
3 changed files with 78 additions and 0 deletions
+17
View File
@@ -112,3 +112,20 @@ class HistoryManager:
{"description": e.description, "timestamp": e.timestamp}
for e in self._undo_stack
]
def jump_to_undo(self, index: int, current_state: typing.Any, current_description: str = "Before Jump") -> typing.Optional[HistoryEntry]:
"""
Jumps to a specific state in the undo stack by moving subsequent states
and the current_state to the redo stack.
"""
if index < 0 or index >= len(self._undo_stack):
return None
# Move current state to redo
self._redo_stack.append(HistoryEntry(state=current_state, description=current_description))
# Move states between index and top of undo to redo
while len(self._undo_stack) > index + 1:
self._redo_stack.append(self._undo_stack.pop())
return self._undo_stack.pop()