* Emit a JSON event. * For stream-json mode: immediately output to stdout * For json mode: accumulate for final output
(event: JsonEvent)
| 818 | * For json mode: accumulate for final output |
| 819 | */ |
| 820 | private emitEvent(event: JsonEvent): void { |
| 821 | const requestId = event.requestId ?? this.requestIdProvider() |
| 822 | const payload = requestId ? { ...event, requestId } : event |
| 823 | |
| 824 | this.events.push(payload) |
| 825 | |
| 826 | if (this.mode === "stream-json") { |
| 827 | this.outputLine(payload) |
| 828 | } |
| 829 | } |
| 830 | |
| 831 | /** |
| 832 | * Output a single JSON line (NDJSON format). |
no test coverage detected