Skip to main content

helm_sdk/
types_gen.rs

1// AUTO-GENERATED from api/openapi/helm.openapi.yaml — DO NOT EDIT
2// Regenerate: bash scripts/sdk/gen.sh
3
4use serde::{Deserialize, Serialize};
5use std::collections::HashMap;
6
7/// Deterministic reason codes returned by the kernel.
8#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
9pub enum ReasonCode {
10    #[serde(rename = "ALLOW")]
11    Allow,
12    #[serde(rename = "DENY_TOOL_NOT_FOUND")]
13    DenyToolNotFound,
14    #[serde(rename = "DENY_SCHEMA_MISMATCH")]
15    DenySchemaMismatch,
16    #[serde(rename = "DENY_OUTPUT_DRIFT")]
17    DenyOutputDrift,
18    #[serde(rename = "DENY_BUDGET_EXCEEDED")]
19    DenyBudgetExceeded,
20    #[serde(rename = "DENY_APPROVAL_REQUIRED")]
21    DenyApprovalRequired,
22    #[serde(rename = "DENY_APPROVAL_TIMEOUT")]
23    DenyApprovalTimeout,
24    #[serde(rename = "DENY_SANDBOX_TRAP")]
25    DenySandboxTrap,
26    #[serde(rename = "DENY_GAS_EXHAUSTION")]
27    DenyGasExhaustion,
28    #[serde(rename = "DENY_TIME_LIMIT")]
29    DenyTimeLimit,
30    #[serde(rename = "DENY_MEMORY_LIMIT")]
31    DenyMemoryLimit,
32    #[serde(rename = "DENY_POLICY_VIOLATION")]
33    DenyPolicyViolation,
34    #[serde(rename = "DENY_TRUST_KEY_REVOKED")]
35    DenyTrustKeyRevoked,
36    #[serde(rename = "DENY_IDEMPOTENCY_DUPLICATE")]
37    DenyIdempotencyDuplicate,
38    #[serde(rename = "ERROR_INTERNAL")]
39    ErrorInternal,
40}
41
42#[derive(Debug, Clone, Serialize, Deserialize)]
43pub struct HelmErrorDetail {
44    pub message: String,
45    #[serde(rename = "type")]
46    pub error_type: String,
47    pub code: String,
48    pub reason_code: ReasonCode,
49    pub details: Option<HashMap<String, serde_json::Value>>,
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
53pub struct HelmError {
54    pub error: HelmErrorDetail,
55}
56
57#[derive(Debug, Clone, Serialize, Deserialize)]
58pub struct ChatMessage {
59    pub role: String,
60    pub content: String,
61    #[serde(skip_serializing_if = "Option::is_none")]
62    pub tool_call_id: Option<String>,
63}
64
65#[derive(Debug, Clone, Serialize, Deserialize)]
66pub struct ToolFunction {
67    pub name: String,
68    #[serde(skip_serializing_if = "Option::is_none")]
69    pub description: Option<String>,
70    #[serde(skip_serializing_if = "Option::is_none")]
71    pub parameters: Option<serde_json::Value>,
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
75pub struct Tool {
76    #[serde(rename = "type")]
77    pub tool_type: String,
78    pub function: ToolFunction,
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
82pub struct ChatCompletionRequest {
83    pub model: String,
84    pub messages: Vec<ChatMessage>,
85    #[serde(skip_serializing_if = "Option::is_none")]
86    pub tools: Option<Vec<Tool>>,
87    #[serde(skip_serializing_if = "Option::is_none")]
88    pub temperature: Option<f64>,
89    #[serde(skip_serializing_if = "Option::is_none")]
90    pub max_tokens: Option<u32>,
91    #[serde(skip_serializing_if = "Option::is_none")]
92    pub stream: Option<bool>,
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
96pub struct ToolCallFn {
97    pub name: String,
98    pub arguments: String,
99}
100
101#[derive(Debug, Clone, Serialize, Deserialize)]
102pub struct ToolCall {
103    pub id: String,
104    #[serde(rename = "type")]
105    pub call_type: String,
106    pub function: ToolCallFn,
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
110pub struct ChoiceMessage {
111    pub role: String,
112    pub content: Option<String>,
113    #[serde(skip_serializing_if = "Option::is_none")]
114    pub tool_calls: Option<Vec<ToolCall>>,
115}
116
117#[derive(Debug, Clone, Serialize, Deserialize)]
118pub struct Choice {
119    pub index: u32,
120    pub message: ChoiceMessage,
121    pub finish_reason: String,
122}
123
124#[derive(Debug, Clone, Serialize, Deserialize)]
125pub struct Usage {
126    pub prompt_tokens: u32,
127    pub completion_tokens: u32,
128    pub total_tokens: u32,
129}
130
131#[derive(Debug, Clone, Serialize, Deserialize)]
132pub struct ChatCompletionResponse {
133    pub id: String,
134    pub object: String,
135    pub created: i64,
136    pub model: String,
137    pub choices: Vec<Choice>,
138    pub usage: Option<Usage>,
139}
140
141#[derive(Debug, Clone, Serialize, Deserialize)]
142pub struct ApprovalRequest {
143    pub intent_hash: String,
144    pub signature_b64: String,
145    pub public_key_b64: String,
146    #[serde(skip_serializing_if = "Option::is_none")]
147    pub challenge_response: Option<String>,
148}
149
150#[derive(Debug, Clone, Serialize, Deserialize)]
151pub struct Receipt {
152    pub receipt_id: String,
153    pub decision_id: String,
154    pub effect_id: String,
155    pub status: String,
156    pub reason_code: String,
157    pub output_hash: String,
158    pub blob_hash: String,
159    pub prev_hash: String,
160    pub lamport_clock: i64,
161    pub signature: String,
162    pub timestamp: String,
163    pub principal: String,
164}
165
166#[derive(Debug, Clone, Serialize, Deserialize)]
167pub struct Session {
168    pub session_id: String,
169    pub created_at: String,
170    pub receipt_count: u32,
171    pub last_lamport_clock: i64,
172}
173
174#[derive(Debug, Clone, Serialize, Deserialize)]
175pub struct VerificationResult {
176    pub verdict: String,
177    pub checks: HashMap<String, String>,
178    pub errors: Vec<String>,
179}
180
181#[derive(Debug, Clone, Serialize, Deserialize)]
182pub struct ConformanceRequest {
183    pub level: String,
184    #[serde(skip_serializing_if = "Option::is_none")]
185    pub profile: Option<String>,
186}
187
188#[derive(Debug, Clone, Serialize, Deserialize)]
189pub struct ConformanceResult {
190    pub report_id: String,
191    pub level: String,
192    pub verdict: String,
193    pub gates: u32,
194    pub failed: u32,
195    pub details: Option<HashMap<String, String>>,
196}
197
198#[derive(Debug, Clone, Serialize, Deserialize)]
199pub struct VersionInfo {
200    pub version: String,
201    pub commit: String,
202    pub build_time: String,
203    pub go_version: String,
204}