* Drain the stream_event delay buffer: accumulate text_deltas into * full-so-far snapshots, clear the timer, enqueue the resulting events. * Called from the timer, from writeEvent on a non-stream message, and from * flush(). close() drops the buffer — call flush() first if you need * del
()
| 769 | * delivery. |
| 770 | */ |
| 771 | private async flushStreamEventBuffer(): Promise<void> { |
| 772 | if (this.streamEventTimer) { |
| 773 | clearTimeout(this.streamEventTimer) |
| 774 | this.streamEventTimer = null |
| 775 | } |
| 776 | if (this.streamEventBuffer.length === 0) return |
| 777 | const buffered = this.streamEventBuffer |
| 778 | this.streamEventBuffer = [] |
| 779 | const payloads = accumulateStreamEvents( |
| 780 | buffered, |
| 781 | this.streamTextAccumulator, |
| 782 | ) |
| 783 | await this.eventUploader.enqueue( |
| 784 | payloads.map(payload => ({ payload, ephemeral: true })), |
| 785 | ) |
| 786 | } |
| 787 | |
| 788 | /** |
| 789 | * Write an internal worker event via POST /sessions/{id}/worker/internal-events. |
no test coverage detected