Skip to main content

hanzo_protocol/
config_types.rs

1use schemars::JsonSchema;
2use serde::Deserialize;
3use serde::Serialize;
4use strum_macros::Display;
5use strum_macros::EnumIter;
6use ts_rs::TS;
7
8use crate::protocol::AskForApproval;
9
10/// See https://platform.openai.com/docs/guides/reasoning?api-mode=responses#get-started-with-reasoning
11#[derive(
12    Debug, Serialize, Deserialize, Default, Clone, Copy, PartialEq, Eq, Display, TS, EnumIter,
13)]
14#[serde(rename_all = "lowercase")]
15#[strum(serialize_all = "lowercase")]
16pub enum ReasoningEffort {
17    /// Minimal reasoning effort.
18    /// Note: serde alias "none" removed to avoid ts-rs warning during TS export.
19    Minimal,
20    Low,
21    #[default]
22    Medium,
23    High,
24    XHigh,
25}
26
27/// A summary of the reasoning performed by the model. This can be useful for
28/// debugging and understanding the model's reasoning process.
29/// See https://platform.openai.com/docs/guides/reasoning?api-mode=responses#reasoning-summaries
30#[derive(Debug, Serialize, Deserialize, Default, Clone, Copy, PartialEq, Eq, Display, TS)]
31#[serde(rename_all = "lowercase")]
32#[strum(serialize_all = "lowercase")]
33pub enum ReasoningSummary {
34    #[default]
35    Auto,
36    Concise,
37    Detailed,
38    /// Option to disable reasoning summaries.
39    None,
40}
41
42/// Controls output length/detail on GPT-5 models via the Responses API.
43/// Serialized with lowercase values to match the OpenAI API.
44#[derive(
45    Debug, Serialize, Deserialize, Default, Clone, Copy, PartialEq, Eq, Display, TS, JsonSchema,
46)]
47#[serde(rename_all = "lowercase")]
48#[strum(serialize_all = "lowercase")]
49pub enum Verbosity {
50    Low,
51    #[default]
52    Medium,
53    High,
54}
55
56#[derive(Deserialize, Debug, Clone, Copy, PartialEq, Default, Serialize, Display, TS)]
57#[serde(rename_all = "kebab-case")]
58#[strum(serialize_all = "kebab-case")]
59pub enum SandboxMode {
60    #[serde(rename = "read-only")]
61    #[default]
62    ReadOnly,
63
64    #[serde(rename = "workspace-write")]
65    WorkspaceWrite,
66
67    #[serde(rename = "danger-full-access")]
68    DangerFullAccess,
69}
70
71/// Collection of common configuration options that a user can define as a unit
72/// in `config.toml`. Currently only a subset of the fields are supported.
73#[derive(Deserialize, Debug, Clone, PartialEq, Serialize, TS)]
74#[serde(rename_all = "camelCase")]
75pub struct ConfigProfile {
76    pub model: Option<String>,
77    pub approval_policy: Option<AskForApproval>,
78    pub model_reasoning_effort: Option<ReasoningEffort>,
79}