mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-05-20 00:22:31 +00:00
Extract checkpoint and turn-persistence logic from AgentLoop into two dedicated modules to reduce loop.py's size and improve reviewability. - checkpoint.py: CheckpointManager handles runtime checkpoints, pending user-turn markers, and session recovery after cancellation/crash. - turn_writer.py: TurnWriter handles message sanitization, turn saving, early user-message persistence, and subagent-followup persistence. AgentLoop retains thin delegate methods for full backward compatibility. Test helpers updated to initialize the new sub-managers.