Formats and emits newline-delimited JSON (JSONL) events to stdout for real-time streaming output of CLI session data and stats.
// Source: https://github.com/google-gemini/gemini-cli | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type {
JsonStreamEvent,
ModelStreamStats,
StreamStats,
} from './types.js';
import type { SessionMetrics } from '../telemetry/uiTelemetry.js';
/**
* Formatter for streaming JSON output.
* Emits newline-delimited JSON (JSONL) events to stdout in real-time.
*/
export class StreamJsonFormatter {
/**
* Formats a single event as a JSON string with newline (JSONL format).
* @param event - The stream event to format
* @returns JSON string with trailing newline
*/
for
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key