streamStartFailureTurnEnd function

  1. @visibleForTesting
NativeLastTurnEnd streamStartFailureTurnEnd(
  1. NativeLastTurnEnd? recorded
)

The turn end to expose when send_message_stream itself returned an error. Preserve native's record: LiteRT-LM 0.19 can append a message to its history before media conversion fails, so a failed start must rebuild the conversation even though no stream task was started. A failure with no record is a refusal before native accepted a turn.

Implementation

@visibleForTesting
NativeLastTurnEnd streamStartFailureTurnEnd(NativeLastTurnEnd? recorded) =>
    recorded ?? NativeLastTurnEnd.refused;