/**
 * Stream JSON Formatter
 *
 * Formats streaming output as newline-delimited JSON (NDJSON).
 * Each event is a JSON object on its own line, suitable for
 * machine-readable streaming output via --output-format stream-json.
 */
// ============================================================================
// Formatter
// ============================================================================
export class StreamJsonFormatter {
    /**
     * Format a single event as an NDJSON line (JSON + newline).
     */
    formatEvent(event) {
        return JSON.stringify(event) + '\n';
    }
    /**
     * Format multiple events as NDJSON.
     */
    formatEvents(events) {
        return events.map(e => this.formatEvent(e)).join('');
    }
    /**
     * Create a start event.
     */
    start(sessionId, model) {
        return this.formatEvent({ type: 'start', session_id: sessionId, model });
    }
    /**
     * Create a text event.
     */
    text(content) {
        return this.formatEvent({ type: 'text', content });
    }
    /**
     * Create a tool_use event.
     */
    toolUse(tool, input) {
        return this.formatEvent({ type: 'tool_use', tool, input });
    }
    /**
     * Create a tool_result event.
     */
    toolResult(tool, output, success) {
        return this.formatEvent({ type: 'tool_result', tool, output, success });
    }
    /**
     * Create a thinking event.
     */
    thinking(content) {
        return this.formatEvent({ type: 'thinking', content });
    }
    /**
     * Create a done event.
     */
    done(cost, tokens) {
        return this.formatEvent({ type: 'done', cost, tokens });
    }
}
//# sourceMappingURL=stream-json-formatter.js.map