swink-agent 0.8.1

Core scaffolding for running LLM-powered agentic loops
1
2
3
4
5
6
7
8
# Agent Lessons

- `pause()` must snapshot the full in-flight message history, not just `in_flight_llm_messages`. The LLM-only snapshot intentionally drops `CustomMessage`, so streamed pause/resume needs a separate authoritative in-flight message clone to avoid serializing stale or incomplete checkpoints.
- Checkpoint restore must validate the optional `session_state` snapshot before mutating `messages`, `system_prompt`, `model`, or live queues. A corrupt state snapshot must leave the in-memory agent unchanged.
- `restore_from_checkpoint()` and `load_and_restore_checkpoint()` must reject active runs with `io::ErrorKind::WouldBlock` instead of clearing transient runtime state under a live loop. Raw checkpoint restore now has the same idle precondition as `resume*()`.
- `pause()` also has to snapshot loop-local `pending_messages`, not only the live steering/follow-up queues. Follow-up or steering items can already be drained out of the shared queues and staged for the next turn when pause is requested; without the mirrored pending snapshot, those messages disappear from the checkpoint.
- `new_blocking_runtime()` must propagate Tokio runtime construction failures as `AgentError::RuntimeInit` instead of panicking. The sync invoke helpers already return `Result`, so runtime bootstrap failures are part of the public error contract.
- `continue_*()` from an assistant tail must drain any queued steering/follow-up messages into the resumed history before the first new streamed turn. Otherwise text-only turns can re-poll those already-pending queues after `TurnEnd`, spuriously creating an extra turn and surfacing `StopReason::Error`.