| 1 | package control |
| 2 | |
| 3 | import ( |
| 4 | "errors" |
| 5 | |
| 6 | "reasonix/internal/agent" |
| 7 | "reasonix/internal/event" |
| 8 | ) |
| 9 | |
| 10 | // turnOutcome maps a finished run's typed pause onto the TurnDone outcome |
| 11 | // string. Empty means an ordinary success or failure. |
| 12 | func turnOutcome(err error) string { |
| 13 | var readErr *agent.IncompleteReadError |
| 14 | if errors.As(err, &readErr) { |
| 15 | return event.TurnOutcomeIncompleteRead |
| 16 | } |
| 17 | var readinessErr *agent.FinalReadinessError |
| 18 | if errors.As(err, &readinessErr) { |
| 19 | return event.TurnOutcomeFinalReadiness |
| 20 | } |
| 21 | var pauseErr *agent.RecoveryPauseError |
| 22 | if errors.As(err, &pauseErr) { |
| 23 | return event.TurnOutcomeRecoveryPaused |
| 24 | } |
| 25 | var completionErr *agent.CompletionUncertainError |
| 26 | if errors.As(err, &completionErr) { |
| 27 | return event.TurnOutcomeCompletionUncertain |
| 28 | } |
| 29 | return "" |
| 30 | } |
| 31 |