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")]
9#[non_exhaustive]
10pub enum DumpFormat {
11    /// Write LLM requests as pretty-printed internal zeph-llm JSON (`{id}-request.json`).
12    #[default]
13    Json,
14    /// Write LLM requests as the actual API payload sent to the provider (`{id}-request.json`):
15    /// system extracted, `agent_invisible` messages filtered, parts rendered as content blocks.
16    Raw,
17    /// Emit OpenTelemetry-compatible OTLP JSON trace spans (`trace.json` at session end).
18    /// Legacy numbered dump files are NOT written unless `[debug.traces] legacy_files = true`.
19    Trace,
20}
21
22impl std::str::FromStr for DumpFormat {
23    type Err = String;
24
25    fn from_str(s: &str) -> Result<Self, Self::Err> {
26        match s {
27            "json" => Ok(Self::Json),
28            "raw" => Ok(Self::Raw),
29            "trace" => Ok(Self::Trace),
30            other => Err(format!(
31                "unknown dump format `{other}`, expected json|raw|trace"
32            )),
33        }
34    }
35}