1#![allow(dead_code)]
2
3use serde::{Deserialize, Serialize};
4
5#[derive(Serialize)]
8pub struct PaidRequest {
9 pub q: String,
10 pub wiki: String,
11 pub owner: Option<String>,
12 pub limit: u32,
13 #[serde(skip_serializing_if = "Option::is_none")]
14 pub expand: Option<bool>,
15 #[serde(skip_serializing_if = "Option::is_none")]
16 pub article_ids: Option<Vec<String>>,
17 pub transaction_digest: String,
18 pub signature: String,
19 pub bytes: String,
20}
21
22#[derive(Deserialize, Debug)]
25pub struct SearchResponse {
26 pub query_text: String,
27 pub wiki_scope: String,
28 pub results: Vec<SearchResult>,
29 pub budget: BudgetBreakdown,
30 pub payments: Vec<PaymentLine>,
31}
32
33#[derive(Deserialize, Debug)]
34pub struct SearchResult {
35 pub article_id: String,
36 pub relative_path: String,
37 pub title: Option<String>,
38 pub summary: Option<String>,
39 pub best_match: Option<BestMatch>,
40 pub chunk_token_count: u32,
41 pub raw_vector_score: Option<f64>,
42 pub raw_lexical_score: Option<f64>,
43 pub tags: Vec<String>,
44 pub signals: Signals,
45}
46
47#[derive(Deserialize, Debug)]
48pub struct BestMatch {
49 pub excerpt: String,
50 pub heading_path: Vec<String>,
51 pub char_start: u32,
52 pub char_end: u32,
53}
54
55#[derive(Deserialize, Debug)]
56pub struct Signals {
57 pub relevance_score: f64,
58 pub article_token_count: u32,
59 pub recency_days: u32,
60 pub tag_confidence: f64,
61 pub wiki_file_count: u32,
62 pub primary_tag: String,
63}
64
65#[derive(Deserialize, Debug)]
68pub struct ChunksResponse {
69 pub query_text: String,
70 pub wiki_scope: String,
71 pub chunks: Vec<ChunkPreview>,
72 pub budget: BudgetBreakdown,
73 pub payments: Vec<PaymentLine>,
74 pub formatted_context: String,
75 pub total_tokens: u32,
76}
77
78#[derive(Deserialize, Debug)]
79pub struct ChunkPreview {
80 pub chunk_id: u64,
81 pub article_id: String,
82 pub relative_path: String,
83 pub owner_address: String,
84 pub title: String,
85 pub heading_path: Vec<String>,
86 pub chunk_token_count: u32,
87 pub scores: ChunkScores,
88 pub text: String,
89 pub content_type: String,
90 pub language: Option<String>,
91 pub truncated: Option<TruncatedInfo>,
92}
93
94#[derive(Deserialize, Debug)]
95pub struct ChunkScores {
96 pub document: f32,
97 pub passage: f32,
98 pub blended: f32,
99 pub vector: Option<f32>,
100 pub lexical: Option<f32>,
101}
102
103#[derive(Deserialize, Debug)]
106pub struct BudgetBreakdown {
107 pub paid_usdc: String,
108 pub consumed_usdc: String,
109 pub remaining_usdc: String,
110 pub platform_fee_usdc: String,
111 pub creators_fee_usdc: String,
112 pub items_returned: u32,
113 pub items_searched: u32,
114}
115
116#[derive(Deserialize, Debug)]
117pub struct PaymentLine {
118 pub recipient: String,
119 pub amount_usdc: String,
120}
121
122#[derive(Serialize, Deserialize)]
124pub struct ApiAccessMessage {
125 pub q: String,
126 pub wiki: String,
127 pub transaction_digest: String,
128 pub timestamp: u64,
129 pub expand: Option<bool>,
130 pub article_ids: Option<Vec<String>>,
131}
132
133#[derive(Serialize)]
136pub struct AgentSearchResult {
137 pub article_id: String,
138 pub title: String,
139 pub excerpt: Option<String>,
140 pub heading_path: Vec<String>,
141 pub score: f64,
142 pub article_token_count: u32,
143 pub recency_days: u32,
144 pub tags: Vec<String>,
145}
146
147#[derive(Serialize)]
148pub struct AgentSearchResponse {
149 pub results: Vec<AgentSearchResult>,
150 pub budget: AgentBudget,
151}
152
153#[derive(Serialize)]
154pub struct AgentChunkResult {
155 pub chunk_id: u64,
156 pub article_id: String,
157 pub title: String,
158 pub text: String,
159 pub score: f32,
160 pub chunk_token_count: u32,
161 pub heading_path: Vec<String>,
162 pub content_type: String,
163 pub language: Option<String>,
164 pub truncated: Option<TruncatedInfo>,
165}
166
167#[derive(Serialize)]
168pub struct AgentChunksResponse {
169 pub chunks: Vec<AgentChunkResult>,
170 pub budget: AgentBudget,
171}
172
173#[derive(Serialize)]
174pub struct AgentBudget {
175 pub paid_usdc: String,
176 pub consumed_usdc: String,
177 pub remaining_usdc: String,
178}
179
180#[derive(Serialize, Deserialize)]
184pub struct ExpandAccessMessage {
185 pub chunk_ids: Vec<i64>,
186 pub transaction_digest: String,
187 pub timestamp: u64,
188}
189
190#[derive(Serialize)]
191pub struct ExpandRequest {
192 pub chunk_ids: Vec<i64>,
193 pub transaction_digest: String,
194 pub signature: String,
195 pub bytes: String,
196}
197
198#[derive(Deserialize, Debug)]
199pub struct ExpandResponse {
200 pub chunks: Vec<ExpandedChunk>,
201 pub budget: BudgetBreakdown,
202 pub payments: Vec<PaymentLine>,
203}
204
205#[derive(Deserialize, Debug)]
206pub struct ExpandedChunk {
207 pub chunk_id: u64,
208 pub article_id: String,
209 pub owner_address: String,
210 pub ordinal: u32,
211 pub heading_path: Vec<String>,
212 pub char_start: u32,
213 pub char_end: u32,
214 pub token_count: u32,
215 pub chunk_text: String,
216 pub content_type: String,
217 pub language: Option<String>,
218 pub truncated: Option<TruncatedInfo>,
219}
220
221#[derive(Clone, Deserialize, Debug, Serialize)]
222pub struct TruncatedInfo {
223 pub content_type: String,
224 #[serde(default)]
225 pub table_rows_total: Option<u32>,
226 #[serde(default)]
227 pub table_rows_shown: Option<u32>,
228 #[serde(default)]
229 pub code_lines_total: Option<u32>,
230 #[serde(default)]
231 pub code_lines_shown: Option<u32>,
232 #[serde(default)]
233 pub prose_chars_total: Option<u32>,
234 #[serde(default)]
235 pub prose_chars_shown: Option<u32>,
236}
237
238#[derive(Serialize)]
239pub struct AgentExpandedChunk {
240 pub chunk_id: u64,
241 pub article_id: String,
242 pub heading_path: Vec<String>,
243 pub chunk_text: String,
244 pub content_type: String,
245 pub token_count: u32,
246 pub truncated: Option<TruncatedInfo>,
247}
248
249#[derive(Serialize)]
250pub struct AgentExpandResponse {
251 pub chunks: Vec<AgentExpandedChunk>,
252 pub budget: AgentBudget,
253}