Computes the safe byte/character commit boundary for streaming text,
holding back any incomplete credentials (e.g. split across deltas) or open PEM blocks.
Parameters
text: string
Cumulative streamed text.
isFinished: boolean = false
Whether the turn has concluded and trailing text may be flushed.
Returns number
Index up to which text is safe to commit and redact.
Computes the safe byte/character commit boundary for streaming text, holding back any incomplete credentials (e.g. split across deltas) or open PEM blocks.