Skip to main content

gproxy_protocol/claude/common/server_tools/
response_payloads.rs

1use serde::{Deserialize, Serialize};
2
3use super::super::{
4    Base64PdfSource, DocumentBlockType, JsonObject, PlainTextSource, ResponseToolReferenceBlock,
5    StopReason,
6};
7use super::{
8    TextEditorCodeExecutionFileType, TextEditorCodeExecutionStrReplaceResultBlockType,
9    TextEditorCodeExecutionToolResultErrorCode, TextEditorCodeExecutionToolResultErrorType,
10    TextEditorCodeExecutionViewResultBlockType, ToolSearchToolResultErrorCode,
11    ToolSearchToolResultErrorType,
12};
13
14#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
15#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
16pub struct ResponseWebFetchResultBlock {
17    pub content: ResponseWebFetchDocumentBlock,
18    pub retrieved_at: String,
19    #[serde(rename = "type")]
20    pub type_: ResponseWebFetchResultBlockType,
21    pub url: String,
22    #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
23    pub rest: serde_json::Map<String, serde_json::Value>,
24}
25
26#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
27#[non_exhaustive]
28pub enum ResponseWebFetchResultBlockType {
29    #[serde(rename = "web_fetch_result")]
30    WebFetchResult,
31}
32
33#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
34#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
35pub struct ResponseWebFetchDocumentBlock {
36    pub citations: ResponseWebFetchCitationConfig,
37    pub source: ResponseWebFetchDocumentSource,
38    pub title: String,
39    #[serde(rename = "type")]
40    pub type_: DocumentBlockType,
41    #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
42    pub rest: serde_json::Map<String, serde_json::Value>,
43}
44
45#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
46#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
47pub struct ResponseWebFetchCitationConfig {
48    pub enabled: bool,
49    #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
50    pub rest: serde_json::Map<String, serde_json::Value>,
51}
52
53#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
54#[serde(untagged)]
55#[non_exhaustive]
56pub enum ResponseWebFetchDocumentSource {
57    Base64(Base64PdfSource),
58    Text(PlainTextSource),
59    Raw(serde_json::Value),
60}
61
62#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
63#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
64pub struct ResponseAdvisorResultBlock {
65    pub stop_reason: StopReason,
66    pub text: String,
67    #[serde(rename = "type")]
68    pub type_: ResponseAdvisorResultBlockType,
69    #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
70    pub rest: serde_json::Map<String, serde_json::Value>,
71}
72
73#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
74#[non_exhaustive]
75pub enum ResponseAdvisorResultBlockType {
76    #[serde(rename = "advisor_result")]
77    AdvisorResult,
78}
79
80#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
81#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
82pub struct ResponseAdvisorRedactedResultBlock {
83    pub encrypted_content: String,
84    pub stop_reason: StopReason,
85    #[serde(rename = "type")]
86    pub type_: ResponseAdvisorRedactedResultBlockType,
87    #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
88    pub rest: serde_json::Map<String, serde_json::Value>,
89}
90
91#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
92#[non_exhaustive]
93pub enum ResponseAdvisorRedactedResultBlockType {
94    #[serde(rename = "advisor_redacted_result")]
95    AdvisorRedactedResult,
96}
97
98#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
99#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
100pub struct ResponseTextEditorCodeExecutionViewResultBlock {
101    pub content: String,
102    pub file_type: TextEditorCodeExecutionFileType,
103    pub num_lines: u64,
104    pub start_line: u64,
105    pub total_lines: u64,
106    #[serde(rename = "type")]
107    pub type_: TextEditorCodeExecutionViewResultBlockType,
108    #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
109    pub rest: serde_json::Map<String, serde_json::Value>,
110}
111
112#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
113#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
114pub struct ResponseTextEditorCodeExecutionStrReplaceResultBlock {
115    pub lines: Vec<String>,
116    pub new_lines: u64,
117    pub new_start: u64,
118    pub old_lines: u64,
119    pub old_start: u64,
120    #[serde(rename = "type")]
121    pub type_: TextEditorCodeExecutionStrReplaceResultBlockType,
122    #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
123    pub rest: serde_json::Map<String, serde_json::Value>,
124}
125
126pub type ResponseTextEditorCodeExecutionToolResultError = ResponseServerToolResultError<
127    TextEditorCodeExecutionToolResultErrorCode,
128    TextEditorCodeExecutionToolResultErrorType,
129>;
130
131pub type ResponseToolSearchToolResultError =
132    ResponseServerToolResultError<ToolSearchToolResultErrorCode, ToolSearchToolResultErrorType>;
133
134#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
135#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
136pub struct ResponseServerToolResultError<C, T> {
137    pub error_code: C,
138    pub error_message: String,
139    #[serde(rename = "type")]
140    pub type_: T,
141    #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
142    pub rest: serde_json::Map<String, serde_json::Value>,
143}
144
145#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
146#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
147pub struct ResponseToolSearchToolSearchResultBlock {
148    pub tool_references: Vec<ResponseToolReferenceBlock>,
149    #[serde(rename = "type")]
150    pub type_: ResponseToolSearchToolSearchResultBlockType,
151    #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
152    pub rest: serde_json::Map<String, serde_json::Value>,
153}
154
155#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
156#[non_exhaustive]
157pub enum ResponseToolSearchToolSearchResultBlockType {
158    #[serde(rename = "tool_search_tool_search_result")]
159    ToolSearchToolSearchResult,
160}