Skip to main content

zeph_config/
dump_format.rs

1// SPDX-FileCopyrightText: 2026 Andrei G <bug-ops>
2// SPDX-License-Identifier: MIT OR Apache-2.0
3
4use serde::{Deserialize, Serialize};
5
6/// Output format for debug dump files.
7#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
8#[serde(rename_all = "lowercase")]
9pub enum DumpFormat {
10    /// Write LLM requests as pretty-printed internal zeph-llm JSON (`{id}-request.json`).
11    #[default]
12    Json,
13    /// Write LLM requests as the actual API payload sent to the provider (`{id}-request.json`):
14    /// system extracted, `agent_invisible` messages filtered, parts rendered as content blocks.
15    Raw,
16    /// Emit OpenTelemetry-compatible OTLP JSON trace spans (`trace.json` at session end).
17    /// Legacy numbered dump files are NOT written unless `[debug.traces] legacy_files = true`.
18    Trace,
19}
20
21impl std::str::FromStr for DumpFormat {
22    type Err = String;
23
24    fn from_str(s: &str) -> Result<Self, Self::Err> {
25        match s {
26            "json" => Ok(Self::Json),
27            "raw" => Ok(Self::Raw),
28            "trace" => Ok(Self::Trace),
29            other => Err(format!(
30                "unknown dump format `{other}`, expected json|raw|trace"
31            )),
32        }
33    }
34}