| 1 | package control |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "reasonix/internal/agent" |
| 6 | ) |
| 7 | |
| 8 | // CheckpointSession implements agent.SessionCheckpointer. The boundary is |
| 9 | // intentionally semantic: ordinary todo, approval, assistant and turn-end |
| 10 | // events remain eligible for the write-behind batch. |
| 11 | func (c *Controller) CheckpointSession(ctx context.Context, boundary agent.SessionCheckpointBoundary) error { |
| 12 | switch boundary { |
| 13 | case agent.CheckpointBeforeModel, agent.CheckpointBeforeTopTool: |
| 14 | if _, err := c.flushSessionEvents(ctx); err != nil { |
| 15 | return err |
| 16 | } |
| 17 | return nil |
| 18 | default: |
| 19 | return nil |
| 20 | } |
| 21 | } |
| 22 |