| 1 | package cli |
| 2 | |
| 3 | import ( |
| 4 | "strings" |
| 5 | |
| 6 | "reasonix/internal/event" |
| 7 | "reasonix/internal/i18n" |
| 8 | ) |
| 9 | |
| 10 | // commitTurnPauseNotice renders a controlled-pause TurnDone outcome as one |
| 11 | // informational line. Pauses are not send failures: the composer is already |
| 12 | // free and the user continues with an ordinary message. |
| 13 | func (m *chatTUI) commitTurnPauseNotice(e event.Event) { |
| 14 | if e.ProtocolRecovery != nil { |
| 15 | m.commitLine(wrapForViewport("ⓘ "+i18n.M.ProtocolRecoveryLabel+": /recover-context "+e.ProtocolRecovery.ID, m.width, activeCLITheme.info)) |
| 16 | } |
| 17 | var text string |
| 18 | switch e.Outcome { |
| 19 | case event.TurnOutcomeIncompleteRead: |
| 20 | text = "⏸ " + i18n.M.IncompleteReadFinishBlocked |
| 21 | case event.TurnOutcomeRecoveryPaused: |
| 22 | text = "⏸ " + i18n.M.RecoveryPaused |
| 23 | case event.TurnOutcomeCompletionUncertain: |
| 24 | text = "⏸ " + i18n.M.CompletionUncertain |
| 25 | case event.TurnOutcomeFinalReadiness: |
| 26 | text = "ⓘ " + i18n.M.FinalReadinessRecovery |
| 27 | default: |
| 28 | if e.Err != nil && e.Err.Error() != "" && !strings.Contains(e.Err.Error(), "context canceled") { |
| 29 | m.commitLine(wrapForViewport(i18n.M.ErrorPrefix+" "+e.Err.Error(), m.width, activeCLITheme.warn)) |
| 30 | } |
| 31 | return |
| 32 | } |
| 33 | m.commitLine(wrapForViewport(text, m.width, activeCLITheme.info)) |
| 34 | } |
| 35 |