@celestia-island/plana-types 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.toml +38 -0
- package/bindings/FileAnchor.ts +3 -0
- package/bindings/engine.ts +277 -0
- package/bindings/enums.ts +31 -0
- package/bindings/httpTypes.ts +197 -0
- package/bindings/index.ts +47 -0
- package/bindings/mcp/aporia.ts +61 -0
- package/bindings/mcp/eleos.ts +18 -0
- package/bindings/mcp/epieikeia.ts +48 -0
- package/bindings/mcp/haplotes.ts +47 -0
- package/bindings/mcp/hubris.ts +41 -0
- package/bindings/mcp/index.ts +13 -0
- package/bindings/mcp/kalos.ts +47 -0
- package/bindings/mcp/neikos.ts +76 -0
- package/bindings/mcp/orexis.ts +64 -0
- package/bindings/mcp/philia.ts +57 -0
- package/bindings/mcp/polemos.ts +55 -0
- package/bindings/mcp/skemma.ts +58 -0
- package/bindings/mcp/skopeo.ts +56 -0
- package/bindings/mcp/webAutomation.ts +31 -0
- package/bindings/model.ts +240 -0
- package/bindings/package.json +16 -0
- package/bindings/region.ts +3 -0
- package/bindings/serde_json/JsonValue.ts +3 -0
- package/bindings/ws/agentLifecycle.ts +41 -0
- package/bindings/ws/auth.ts +15 -0
- package/bindings/ws/baseMessages.ts +7 -0
- package/bindings/ws/bridgeNetwork.ts +71 -0
- package/bindings/ws/core.ts +51 -0
- package/bindings/ws/fileBrowsing.ts +57 -0
- package/bindings/ws/handshake.ts +23 -0
- package/bindings/ws/industrial.ts +72 -0
- package/bindings/ws/knowledgeBase.ts +10 -0
- package/bindings/ws/layer2.ts +25 -0
- package/bindings/ws/llmProvider.ts +74 -0
- package/bindings/ws/logs.ts +11 -0
- package/bindings/ws/malkuth.ts +62 -0
- package/bindings/ws/noa.ts +17 -0
- package/bindings/ws/stateSync.ts +19 -0
- package/bindings/ws/systemUi.ts +5 -0
- package/bindings/ws/tasks.ts +6 -0
- package/bindings/ws/views.ts +163 -0
- package/bindings/ws/workspace.ts +11 -0
- package/bindings/ws/yolo.ts +32 -0
- package/examples/schema_dump.rs +51 -0
- package/package.json +6 -0
- package/pnpm-workspace.yaml +2 -0
- package/src/engine.rs +602 -0
- package/src/enums.rs +334 -0
- package/src/external_mcp.rs +132 -0
- package/src/http.rs +1077 -0
- package/src/identity.rs +160 -0
- package/src/lib.rs +1215 -0
- package/src/malkuth.rs +145 -0
- package/src/mcp/aporia.rs +272 -0
- package/src/mcp/eleos.rs +210 -0
- package/src/mcp/epieikeia.rs +194 -0
- package/src/mcp/haplotes.rs +310 -0
- package/src/mcp/hubris.rs +377 -0
- package/src/mcp/kalos.rs +251 -0
- package/src/mcp/mod.rs +23 -0
- package/src/mcp/neikos.rs +533 -0
- package/src/mcp/orexis.rs +493 -0
- package/src/mcp/philia.rs +267 -0
- package/src/mcp/polemos.rs +241 -0
- package/src/mcp/skemma.rs +442 -0
- package/src/mcp/skopeo.rs +282 -0
- package/src/mcp/web_automation.rs +122 -0
- package/src/model.rs +421 -0
- package/src/protocol/base_messages.rs +125 -0
- package/src/protocol/handshake.rs +364 -0
- package/src/protocol/jsonrpc.rs +888 -0
- package/src/protocol/mod.rs +10 -0
- package/src/rbac.rs +786 -0
- package/src/region.rs +362 -0
- package/src/tracing_helpers.rs +9 -0
- package/src/ws/agent/agent_lifecycle.rs +221 -0
- package/src/ws/agent/layer2.rs +126 -0
- package/src/ws/agent/mod.rs +9 -0
- package/src/ws/agent/state_sync.rs +111 -0
- package/src/ws/agent/tasks.rs +43 -0
- package/src/ws/agent/yolo.rs +161 -0
- package/src/ws/mod.rs +10 -0
- package/src/ws/services/auth.rs +99 -0
- package/src/ws/services/industrial.rs +647 -0
- package/src/ws/services/knowledge_base.rs +59 -0
- package/src/ws/services/llm_provider.rs +371 -0
- package/src/ws/services/mod.rs +7 -0
- package/src/ws/ui/bridge_network.rs +96 -0
- package/src/ws/ui/file_browsing.rs +88 -0
- package/src/ws/ui/logs.rs +55 -0
- package/src/ws/ui/mod.rs +11 -0
- package/src/ws/ui/noa.rs +105 -0
- package/src/ws/ui/system_ui.rs +27 -0
- package/src/ws/ui/views.rs +159 -0
- package/src/ws/ui/workspace.rs +73 -0
package/src/http.rs
ADDED
|
@@ -0,0 +1,1077 @@
|
|
|
1
|
+
use serde::{Deserialize, Serialize};
|
|
2
|
+
use std::collections::HashMap;
|
|
3
|
+
|
|
4
|
+
use ts_rs::TS;
|
|
5
|
+
|
|
6
|
+
// ── Provider / Model / Vendor ──────────────────────────────
|
|
7
|
+
|
|
8
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
9
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
10
|
+
pub struct ProviderPublic {
|
|
11
|
+
#[ts(type = "string")]
|
|
12
|
+
pub id: uuid::Uuid,
|
|
13
|
+
pub name: String,
|
|
14
|
+
pub endpoint: String,
|
|
15
|
+
pub api_key_masked: String,
|
|
16
|
+
pub models: Vec<String>,
|
|
17
|
+
pub category: String,
|
|
18
|
+
pub is_default: bool,
|
|
19
|
+
pub enabled: bool,
|
|
20
|
+
pub priority: i32,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
24
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
25
|
+
pub struct ModelInfo {
|
|
26
|
+
pub id: String,
|
|
27
|
+
pub provider_name: String,
|
|
28
|
+
pub provider_id: String,
|
|
29
|
+
pub category: String,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
33
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
34
|
+
pub struct VendorInfo {
|
|
35
|
+
pub id: String,
|
|
36
|
+
pub name: String,
|
|
37
|
+
pub endpoint: String,
|
|
38
|
+
pub category: String,
|
|
39
|
+
pub description: String,
|
|
40
|
+
pub recommended_models: Vec<String>,
|
|
41
|
+
pub plan_models: HashMap<String, Vec<String>>,
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
45
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
46
|
+
pub struct ValidateKeyResponse {
|
|
47
|
+
pub valid: bool,
|
|
48
|
+
pub models: Vec<String>,
|
|
49
|
+
pub recommended_models: Vec<String>,
|
|
50
|
+
pub error: Option<String>,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// ── Generic / Status ───────────────────────────────────────
|
|
54
|
+
|
|
55
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
56
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
57
|
+
pub struct OkResponse {
|
|
58
|
+
pub ok: bool,
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
62
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
63
|
+
pub struct OkIdResponse {
|
|
64
|
+
pub ok: bool,
|
|
65
|
+
pub id: String,
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
69
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
70
|
+
pub struct IdResponse {
|
|
71
|
+
pub id: String,
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
75
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
76
|
+
pub struct CreatedResponse {
|
|
77
|
+
pub created: Vec<String>,
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
81
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
82
|
+
pub struct ErrorResponse {
|
|
83
|
+
pub error: String,
|
|
84
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
85
|
+
#[ts(optional)]
|
|
86
|
+
pub message: Option<String>,
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
90
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
91
|
+
pub struct StatusResponse {
|
|
92
|
+
pub status: String,
|
|
93
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
94
|
+
#[ts(optional)]
|
|
95
|
+
pub agent_id: Option<String>,
|
|
96
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
97
|
+
#[ts(optional)]
|
|
98
|
+
pub platform: Option<String>,
|
|
99
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
100
|
+
#[ts(optional)]
|
|
101
|
+
pub id: Option<String>,
|
|
102
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
103
|
+
#[ts(optional)]
|
|
104
|
+
pub plugin_id: Option<String>,
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// ── Health ─────────────────────────────────────────────────
|
|
108
|
+
|
|
109
|
+
/// Service health status. Serde uses lowercase so JSON returns "ok" etc.
|
|
110
|
+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, TS)]
|
|
111
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
112
|
+
#[serde(rename_all = "lowercase")]
|
|
113
|
+
pub enum ServiceStatus {
|
|
114
|
+
Ok,
|
|
115
|
+
Degraded,
|
|
116
|
+
Unhealthy,
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/// Backend build profile.
|
|
120
|
+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, TS)]
|
|
121
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
122
|
+
#[serde(rename_all = "lowercase")]
|
|
123
|
+
pub enum BackendKind {
|
|
124
|
+
Dev,
|
|
125
|
+
Nightly,
|
|
126
|
+
Prod,
|
|
127
|
+
Mock,
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/// Standard /api/health response for all plana backends.
|
|
131
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
132
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
133
|
+
pub struct HealthResponse {
|
|
134
|
+
pub status: ServiceStatus,
|
|
135
|
+
pub version: String,
|
|
136
|
+
pub kind: BackendKind,
|
|
137
|
+
pub uptime: u64,
|
|
138
|
+
pub network: NetworkInfo,
|
|
139
|
+
pub build_hash: Option<String>,
|
|
140
|
+
pub engine_version: Option<String>,
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
impl HealthResponse {
|
|
144
|
+
pub fn ok(
|
|
145
|
+
version: impl Into<String>,
|
|
146
|
+
kind: BackendKind,
|
|
147
|
+
uptime: u64,
|
|
148
|
+
network: NetworkInfo,
|
|
149
|
+
) -> Self {
|
|
150
|
+
Self {
|
|
151
|
+
status: ServiceStatus::Ok,
|
|
152
|
+
version: version.into(),
|
|
153
|
+
kind,
|
|
154
|
+
uptime,
|
|
155
|
+
network,
|
|
156
|
+
build_hash: None,
|
|
157
|
+
engine_version: None,
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/// Network context from the incoming request.
|
|
163
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
164
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
165
|
+
pub struct NetworkInfo {
|
|
166
|
+
pub transport: String,
|
|
167
|
+
pub region: String,
|
|
168
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
169
|
+
pub asn: Option<u32>,
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
impl NetworkInfo {
|
|
173
|
+
pub fn unknown() -> Self {
|
|
174
|
+
Self {
|
|
175
|
+
transport: "sse".into(),
|
|
176
|
+
region: "XX".into(),
|
|
177
|
+
asn: None,
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
183
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
184
|
+
pub struct HealthDetailed {
|
|
185
|
+
#[serde(rename = "shittimChest")]
|
|
186
|
+
pub shittim_chest: ConnectionStatus,
|
|
187
|
+
pub scepter: ConnectionStatus,
|
|
188
|
+
pub database: ConnectionStatus,
|
|
189
|
+
#[serde(rename = "activeSessions")]
|
|
190
|
+
pub active_sessions: u32,
|
|
191
|
+
pub uptime: u64,
|
|
192
|
+
pub version: String,
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
196
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
197
|
+
pub struct ConnectionStatus {
|
|
198
|
+
pub connected: bool,
|
|
199
|
+
pub latency: u64,
|
|
200
|
+
#[serde(rename = "lastCheck")]
|
|
201
|
+
pub last_check: String,
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// ── Token usage ────────────────────────────────────────────
|
|
205
|
+
|
|
206
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
207
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
208
|
+
pub struct TokenUsageResponse {
|
|
209
|
+
pub usage: Vec<UsageEntry>,
|
|
210
|
+
pub total_tokens: i64,
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
214
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
215
|
+
pub struct UsageEntry {
|
|
216
|
+
pub model: String,
|
|
217
|
+
pub token_count: u64,
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
221
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
222
|
+
pub struct UsageDataResponse {
|
|
223
|
+
pub period: String,
|
|
224
|
+
pub total_tokens: u64,
|
|
225
|
+
pub total_cost_usd: f64,
|
|
226
|
+
pub by_model: Vec<UsageModelEntry>,
|
|
227
|
+
pub by_day: Vec<UsageDayEntry>,
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
231
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
232
|
+
pub struct UsageModelEntry {
|
|
233
|
+
pub model: String,
|
|
234
|
+
pub tokens: u64,
|
|
235
|
+
pub cost_usd: f64,
|
|
236
|
+
pub requests: u32,
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
240
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
241
|
+
pub struct UsageDayEntry {
|
|
242
|
+
pub date: String,
|
|
243
|
+
pub tokens: u64,
|
|
244
|
+
pub requests: u32,
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// ── Proxy / System info ────────────────────────────────────
|
|
248
|
+
|
|
249
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
250
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
251
|
+
pub struct ProxySystemInfo {
|
|
252
|
+
pub version: String,
|
|
253
|
+
#[serde(rename = "nodeVersion")]
|
|
254
|
+
pub node_version: String,
|
|
255
|
+
pub platform: String,
|
|
256
|
+
#[serde(rename = "cpuUsage")]
|
|
257
|
+
pub cpu_usage: f64,
|
|
258
|
+
#[serde(rename = "memoryUsage")]
|
|
259
|
+
pub memory_usage: f64,
|
|
260
|
+
#[serde(rename = "diskUsage")]
|
|
261
|
+
pub disk_usage: f64,
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
265
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
266
|
+
pub struct SystemInfoResponse {
|
|
267
|
+
pub version: String,
|
|
268
|
+
pub uptime_secs: u64,
|
|
269
|
+
pub agents: SystemInfoAgents,
|
|
270
|
+
pub resources: SystemInfoResources,
|
|
271
|
+
pub connections: SystemInfoConnections,
|
|
272
|
+
pub database: SystemInfoDatabase,
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
276
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
277
|
+
pub struct SystemInfoAgents {
|
|
278
|
+
pub total: u32,
|
|
279
|
+
pub running: u32,
|
|
280
|
+
pub idle: u32,
|
|
281
|
+
pub stopped: u32,
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
285
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
286
|
+
pub struct SystemInfoResources {
|
|
287
|
+
pub cpu_usage_pct: f64,
|
|
288
|
+
pub memory_used_gb: f64,
|
|
289
|
+
pub memory_total_gb: f64,
|
|
290
|
+
pub disk_used_gb: f64,
|
|
291
|
+
pub disk_total_gb: f64,
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
295
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
296
|
+
pub struct SystemInfoConnections {
|
|
297
|
+
pub active_ws: u32,
|
|
298
|
+
pub active_http: u32,
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
302
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
303
|
+
pub struct SystemInfoDatabase {
|
|
304
|
+
pub engine: String,
|
|
305
|
+
pub size_mb: u32,
|
|
306
|
+
pub connections: u32,
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// ── RBAC ───────────────────────────────────────────────────
|
|
310
|
+
|
|
311
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
312
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
313
|
+
pub struct RbacUser {
|
|
314
|
+
pub id: String,
|
|
315
|
+
pub username: String,
|
|
316
|
+
pub email: String,
|
|
317
|
+
pub display_name: String,
|
|
318
|
+
pub avatar_url: Option<String>,
|
|
319
|
+
pub is_active: bool,
|
|
320
|
+
pub is_admin: bool,
|
|
321
|
+
pub role: String,
|
|
322
|
+
pub tier: String,
|
|
323
|
+
pub created_at: String,
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
327
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
328
|
+
pub struct RbacUsersResponse {
|
|
329
|
+
pub users: Vec<RbacUser>,
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
333
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
334
|
+
pub struct RbacGroup {
|
|
335
|
+
pub id: String,
|
|
336
|
+
pub name: String,
|
|
337
|
+
pub description: String,
|
|
338
|
+
pub member_count: u32,
|
|
339
|
+
pub created_at: String,
|
|
340
|
+
pub updated_at: String,
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
344
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
345
|
+
pub struct RbacGroupsResponse {
|
|
346
|
+
pub groups: Vec<RbacGroup>,
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
350
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
351
|
+
pub struct MyPermissions {
|
|
352
|
+
pub role: String,
|
|
353
|
+
pub permissions: Vec<String>,
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// ── OAuth ──────────────────────────────────────────────────
|
|
357
|
+
|
|
358
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
359
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
360
|
+
pub struct OAuthProvider {
|
|
361
|
+
pub provider: String,
|
|
362
|
+
pub client_id: String,
|
|
363
|
+
pub client_secret_masked: String,
|
|
364
|
+
pub public_domain: String,
|
|
365
|
+
pub enabled: bool,
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// ── Workspace / Project ────────────────────────────────────
|
|
369
|
+
|
|
370
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
371
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
372
|
+
pub struct WorkspaceItem {
|
|
373
|
+
pub id: String,
|
|
374
|
+
pub path: String,
|
|
375
|
+
pub editor: String,
|
|
376
|
+
pub git_branch: String,
|
|
377
|
+
pub status: String,
|
|
378
|
+
pub connected: bool,
|
|
379
|
+
pub short_id: String,
|
|
380
|
+
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
381
|
+
#[ts(optional)]
|
|
382
|
+
pub alias: Option<String>,
|
|
383
|
+
pub connection_kind: String,
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
387
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
388
|
+
pub struct AliasRegistryEntry {
|
|
389
|
+
pub workspace_uuid: String,
|
|
390
|
+
pub alias: String,
|
|
391
|
+
pub short_id: String,
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
395
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
396
|
+
pub struct WorkspaceResolveResponse {
|
|
397
|
+
pub workspace_uuid: String,
|
|
398
|
+
pub short_id: String,
|
|
399
|
+
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
400
|
+
#[ts(optional)]
|
|
401
|
+
pub alias: Option<String>,
|
|
402
|
+
pub path: String,
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
406
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
407
|
+
pub struct ProjectItem {
|
|
408
|
+
pub id: String,
|
|
409
|
+
pub name: String,
|
|
410
|
+
pub description: Option<String>,
|
|
411
|
+
pub sort_order: u32,
|
|
412
|
+
pub created_at: String,
|
|
413
|
+
pub updated_at: String,
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// ── Scene ──────────────────────────────────────────────────
|
|
417
|
+
|
|
418
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
419
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
420
|
+
pub struct SceneConfigItem {
|
|
421
|
+
pub project_id: String,
|
|
422
|
+
pub background_color: String,
|
|
423
|
+
pub ground: Option<SceneGround>,
|
|
424
|
+
pub lighting: Option<SceneLighting>,
|
|
425
|
+
pub grid: SceneGrid,
|
|
426
|
+
pub camera: SceneCamera,
|
|
427
|
+
pub bloom: SceneBloom,
|
|
428
|
+
pub ambient_light_intensity: f64,
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
|
|
432
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
433
|
+
pub struct SceneGround {
|
|
434
|
+
pub enabled: bool,
|
|
435
|
+
pub size_x: f64,
|
|
436
|
+
pub size_z: f64,
|
|
437
|
+
pub color: String,
|
|
438
|
+
pub y: f64,
|
|
439
|
+
pub grid_visible: bool,
|
|
440
|
+
pub grid_size: u32,
|
|
441
|
+
pub grid_divisions: u32,
|
|
442
|
+
pub grid_color: String,
|
|
443
|
+
pub grid_opacity: f64,
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
|
|
447
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
448
|
+
pub struct SceneLighting {
|
|
449
|
+
pub ambient_color: [f64; 3],
|
|
450
|
+
pub ambient_intensity: f64,
|
|
451
|
+
pub directional_color: [f64; 3],
|
|
452
|
+
pub directional_intensity: f64,
|
|
453
|
+
pub directional_position: [f64; 3],
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
|
|
457
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
458
|
+
pub struct SceneGrid {
|
|
459
|
+
pub visible: bool,
|
|
460
|
+
pub size: u32,
|
|
461
|
+
pub divisions: u32,
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
|
|
465
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
466
|
+
pub struct SceneCamera {
|
|
467
|
+
pub position: SceneVec3,
|
|
468
|
+
pub target: SceneVec3,
|
|
469
|
+
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
470
|
+
pub bookmarks: Option<std::collections::HashMap<String, SceneCameraBookmark>>,
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
|
|
474
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
475
|
+
pub struct SceneCameraBookmark {
|
|
476
|
+
pub position: SceneVec3,
|
|
477
|
+
pub target: SceneVec3,
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
|
|
481
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
482
|
+
pub struct SceneVec3 {
|
|
483
|
+
pub x: f64,
|
|
484
|
+
pub y: f64,
|
|
485
|
+
pub z: f64,
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
|
|
489
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
490
|
+
pub struct SceneBloom {
|
|
491
|
+
pub strength: f64,
|
|
492
|
+
pub radius: f64,
|
|
493
|
+
pub threshold: f64,
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// ── Channel ────────────────────────────────────────────────
|
|
497
|
+
|
|
498
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
499
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
500
|
+
pub struct ChannelListItem {
|
|
501
|
+
pub platform: String,
|
|
502
|
+
pub enabled: bool,
|
|
503
|
+
pub bot_name: String,
|
|
504
|
+
pub webhook_path: String,
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
508
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
509
|
+
pub struct ChannelListResponse {
|
|
510
|
+
pub channels: Vec<ChannelListItem>,
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
514
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
515
|
+
pub struct ChannelConfigDetail {
|
|
516
|
+
pub id: String,
|
|
517
|
+
pub platform: String,
|
|
518
|
+
pub enabled: bool,
|
|
519
|
+
pub name: String,
|
|
520
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
521
|
+
#[ts(optional)]
|
|
522
|
+
pub description: Option<String>,
|
|
523
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
524
|
+
#[ts(optional)]
|
|
525
|
+
pub bot_token: Option<String>,
|
|
526
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
527
|
+
#[ts(optional)]
|
|
528
|
+
pub app_id: Option<String>,
|
|
529
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
530
|
+
#[ts(optional)]
|
|
531
|
+
pub app_secret: Option<String>,
|
|
532
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
533
|
+
#[ts(optional)]
|
|
534
|
+
pub verify_token: Option<String>,
|
|
535
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
536
|
+
#[ts(optional)]
|
|
537
|
+
pub api_base: Option<String>,
|
|
538
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
539
|
+
#[ts(optional, type = "Record<string, unknown>")]
|
|
540
|
+
pub extra_config: Option<serde_json::Value>,
|
|
541
|
+
pub webhook_path: String,
|
|
542
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
543
|
+
#[ts(optional)]
|
|
544
|
+
pub last_error: Option<String>,
|
|
545
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
546
|
+
#[ts(optional)]
|
|
547
|
+
pub last_tested_at: Option<String>,
|
|
548
|
+
pub created_at: String,
|
|
549
|
+
pub updated_at: String,
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
553
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
554
|
+
pub struct ChannelConfigResponse {
|
|
555
|
+
pub config: ChannelConfigDetail,
|
|
556
|
+
pub active: bool,
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
560
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
561
|
+
pub struct ChannelConfigsResponse {
|
|
562
|
+
pub configs: Vec<ChannelConfigResponse>,
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
566
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
567
|
+
pub struct ChannelMessageItem {
|
|
568
|
+
pub id: String,
|
|
569
|
+
pub platform: String,
|
|
570
|
+
pub direction: String,
|
|
571
|
+
pub message_id: String,
|
|
572
|
+
pub chat_id: String,
|
|
573
|
+
pub sender_id: Option<String>,
|
|
574
|
+
pub text: String,
|
|
575
|
+
pub is_group: bool,
|
|
576
|
+
pub group_id: Option<String>,
|
|
577
|
+
pub error: Option<String>,
|
|
578
|
+
pub created_at: String,
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
582
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
583
|
+
pub struct ChannelMessageListResponse {
|
|
584
|
+
pub messages: Vec<ChannelMessageItem>,
|
|
585
|
+
pub count: usize,
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
// ── Agent ──────────────────────────────────────────────────
|
|
589
|
+
|
|
590
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
591
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
592
|
+
pub struct AgentItem {
|
|
593
|
+
pub id: String,
|
|
594
|
+
pub name: String,
|
|
595
|
+
pub description: String,
|
|
596
|
+
pub agent_type: String,
|
|
597
|
+
pub layer: u32,
|
|
598
|
+
pub status: String,
|
|
599
|
+
pub enabled: bool,
|
|
600
|
+
pub tools: Vec<AgentTool>,
|
|
601
|
+
#[serde(rename = "toolsCount")]
|
|
602
|
+
pub tools_count: usize,
|
|
603
|
+
pub subscribed: bool,
|
|
604
|
+
pub installed: bool,
|
|
605
|
+
pub version: String,
|
|
606
|
+
pub config: AgentConfig,
|
|
607
|
+
pub container: Option<AgentContainer>,
|
|
608
|
+
pub skills: Vec<String>,
|
|
609
|
+
#[serde(rename = "createdAt")]
|
|
610
|
+
pub created_at: String,
|
|
611
|
+
#[serde(rename = "updatedAt")]
|
|
612
|
+
pub updated_at: String,
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
616
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
617
|
+
pub struct AgentTool {
|
|
618
|
+
pub id: String,
|
|
619
|
+
pub name: String,
|
|
620
|
+
pub description: String,
|
|
621
|
+
pub enabled: bool,
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
625
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
626
|
+
pub struct AgentConfig {
|
|
627
|
+
pub max_concurrent_tasks: u32,
|
|
628
|
+
pub timeout_secs: u32,
|
|
629
|
+
pub retry_on_failure: bool,
|
|
630
|
+
pub model: String,
|
|
631
|
+
pub system_prompt: String,
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
635
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
636
|
+
pub struct AgentContainer {
|
|
637
|
+
pub id: String,
|
|
638
|
+
pub image: String,
|
|
639
|
+
pub status: String,
|
|
640
|
+
pub uptime_secs: u64,
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
// ── Webhook ────────────────────────────────────────────────
|
|
644
|
+
|
|
645
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
646
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
647
|
+
pub struct WebhookItem {
|
|
648
|
+
pub id: String,
|
|
649
|
+
pub name: String,
|
|
650
|
+
pub url: String,
|
|
651
|
+
pub platform: String,
|
|
652
|
+
pub secret: String,
|
|
653
|
+
pub events: Vec<String>,
|
|
654
|
+
pub status: String,
|
|
655
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
656
|
+
#[ts(optional)]
|
|
657
|
+
#[serde(rename = "lastDeliveryAt")]
|
|
658
|
+
pub last_delivery_at: Option<String>,
|
|
659
|
+
#[serde(rename = "createdAt")]
|
|
660
|
+
pub created_at: String,
|
|
661
|
+
#[serde(rename = "updatedAt")]
|
|
662
|
+
pub updated_at: String,
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
666
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
667
|
+
pub struct WebhookDeliveryItem {
|
|
668
|
+
pub id: String,
|
|
669
|
+
#[serde(rename = "webhookId")]
|
|
670
|
+
pub webhook_id: String,
|
|
671
|
+
pub event: String,
|
|
672
|
+
#[serde(rename = "statusCode")]
|
|
673
|
+
pub status_code: u16,
|
|
674
|
+
#[serde(rename = "requestHeaders")]
|
|
675
|
+
pub request_headers: HashMap<String, String>,
|
|
676
|
+
#[serde(default, skip_serializing_if = "serde_json::Value::is_null")]
|
|
677
|
+
#[ts(type = "Record<string, unknown>")]
|
|
678
|
+
#[serde(rename = "requestBody")]
|
|
679
|
+
pub request_body: serde_json::Value,
|
|
680
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
681
|
+
#[ts(optional)]
|
|
682
|
+
#[serde(rename = "responseHeaders")]
|
|
683
|
+
pub response_headers: Option<HashMap<String, String>>,
|
|
684
|
+
#[serde(rename = "responseBody")]
|
|
685
|
+
pub response_body: String,
|
|
686
|
+
pub duration: u64,
|
|
687
|
+
pub success: bool,
|
|
688
|
+
#[serde(rename = "deliveredAt")]
|
|
689
|
+
pub delivered_at: String,
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
693
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
694
|
+
pub struct WebhookDeliveryGenItem {
|
|
695
|
+
pub id: String,
|
|
696
|
+
pub webhook_id: String,
|
|
697
|
+
pub event: String,
|
|
698
|
+
pub status: u16,
|
|
699
|
+
pub duration_ms: u64,
|
|
700
|
+
pub timestamp: String,
|
|
701
|
+
pub request_headers: HashMap<String, String>,
|
|
702
|
+
#[serde(default, skip_serializing_if = "serde_json::Value::is_null")]
|
|
703
|
+
#[ts(type = "Record<string, unknown>")]
|
|
704
|
+
pub response_body: serde_json::Value,
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
// ── Skill ──────────────────────────────────────────────────
|
|
708
|
+
|
|
709
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
710
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
711
|
+
pub struct SkillParameterItem {
|
|
712
|
+
pub name: String,
|
|
713
|
+
#[serde(rename = "type")]
|
|
714
|
+
pub param_type: String,
|
|
715
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
716
|
+
#[ts(optional, type = "unknown")]
|
|
717
|
+
pub default: Option<serde_json::Value>,
|
|
718
|
+
pub description: Option<String>,
|
|
719
|
+
pub required: bool,
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
723
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
724
|
+
pub struct SkillItem {
|
|
725
|
+
pub skill_id: String,
|
|
726
|
+
pub name: String,
|
|
727
|
+
pub description: String,
|
|
728
|
+
pub category: String,
|
|
729
|
+
pub agent: String,
|
|
730
|
+
pub agent_types: Vec<String>,
|
|
731
|
+
pub parameters: Vec<SkillParameterItem>,
|
|
732
|
+
pub estimated_duration_secs: u64,
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
// ── Tool ───────────────────────────────────────────────────
|
|
736
|
+
|
|
737
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
738
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
739
|
+
pub struct ToolItem {
|
|
740
|
+
pub tool_id: String,
|
|
741
|
+
pub name: String,
|
|
742
|
+
pub description: String,
|
|
743
|
+
pub category: String,
|
|
744
|
+
pub agent: String,
|
|
745
|
+
#[ts(type = "Record<string, unknown>")]
|
|
746
|
+
pub input_schema: serde_json::Value,
|
|
747
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
748
|
+
#[ts(optional, type = "Record<string, unknown>")]
|
|
749
|
+
pub output_schema: Option<serde_json::Value>,
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
// ── Common response helpers ────────────────────────────────
|
|
753
|
+
|
|
754
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
755
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
756
|
+
pub struct DeletedResponse {
|
|
757
|
+
pub deleted: u64,
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
761
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
762
|
+
pub struct OkMessageResponse {
|
|
763
|
+
pub ok: bool,
|
|
764
|
+
pub message: String,
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
768
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
769
|
+
pub struct ReadinessResponse {
|
|
770
|
+
pub status: String,
|
|
771
|
+
pub database: bool,
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
775
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
776
|
+
pub struct AvatarPlatformResponse {
|
|
777
|
+
pub id: String,
|
|
778
|
+
pub slug: String,
|
|
779
|
+
pub label: String,
|
|
780
|
+
pub url_template: String,
|
|
781
|
+
pub hint: Option<String>,
|
|
782
|
+
pub enabled: bool,
|
|
783
|
+
pub sort_order: i32,
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
787
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
788
|
+
pub struct SetupCheckResponse {
|
|
789
|
+
pub needs_setup: bool,
|
|
790
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
791
|
+
#[ts(optional)]
|
|
792
|
+
pub locale: Option<String>,
|
|
793
|
+
pub registration_enabled: bool,
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
|
|
797
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
798
|
+
pub struct UserPreferences {
|
|
799
|
+
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
800
|
+
#[ts(optional)]
|
|
801
|
+
pub theme: Option<String>,
|
|
802
|
+
#[serde(default, rename = "themeMode", skip_serializing_if = "Option::is_none")]
|
|
803
|
+
#[ts(optional)]
|
|
804
|
+
pub theme_mode: Option<String>,
|
|
805
|
+
#[serde(default, rename = "chatMode", skip_serializing_if = "Option::is_none")]
|
|
806
|
+
#[ts(optional)]
|
|
807
|
+
pub chat_mode: Option<String>,
|
|
808
|
+
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
809
|
+
#[ts(optional)]
|
|
810
|
+
pub locale: Option<String>,
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
814
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
815
|
+
pub struct UserProfileResponse {
|
|
816
|
+
pub id: String,
|
|
817
|
+
pub username: String,
|
|
818
|
+
pub email: String,
|
|
819
|
+
pub display_name: String,
|
|
820
|
+
pub avatar_url: Option<String>,
|
|
821
|
+
pub is_active: bool,
|
|
822
|
+
pub is_admin: bool,
|
|
823
|
+
pub role: String,
|
|
824
|
+
pub groups: Vec<RbacGroup>,
|
|
825
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
826
|
+
#[ts(optional)]
|
|
827
|
+
pub preferences: Option<UserPreferences>,
|
|
828
|
+
pub created_at: String,
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
832
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
833
|
+
pub struct AvatarUpdateResponse {
|
|
834
|
+
pub avatar_url: Option<String>,
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
838
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
839
|
+
pub struct PermissionsResponse {
|
|
840
|
+
pub role: String,
|
|
841
|
+
pub permissions: Vec<String>,
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
845
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
846
|
+
pub struct GrantItem {
|
|
847
|
+
pub id: String,
|
|
848
|
+
pub scope: String,
|
|
849
|
+
pub user_id: Option<String>,
|
|
850
|
+
pub group_id: Option<String>,
|
|
851
|
+
pub permission: String,
|
|
852
|
+
pub resource_id: Option<String>,
|
|
853
|
+
pub granted: bool,
|
|
854
|
+
pub created_at: String,
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
impl GrantItem {
|
|
858
|
+
/// Validate that the `permission` field holds a valid Permission path
|
|
859
|
+
/// (leaf node like `"agent.read"`) or domain name (branch like `"agent"`).
|
|
860
|
+
/// Returns `None` when valid; otherwise returns the invalid path.
|
|
861
|
+
#[must_use]
|
|
862
|
+
pub fn validate_permission(&self) -> Option<&str> {
|
|
863
|
+
let valid = crate::rbac::Permission::from_path(&self.permission).is_some()
|
|
864
|
+
|| !crate::rbac::Permission::expand_domain(&self.permission).is_empty();
|
|
865
|
+
if valid { None } else { Some(&self.permission) }
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
870
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
871
|
+
pub struct GrantListResponse {
|
|
872
|
+
pub grants: Vec<GrantItem>,
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
876
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
877
|
+
pub struct DeviceResponse {
|
|
878
|
+
pub id: String,
|
|
879
|
+
pub device_id: String,
|
|
880
|
+
pub name: String,
|
|
881
|
+
pub device_type: String,
|
|
882
|
+
pub status: String,
|
|
883
|
+
pub last_seen_at: Option<String>,
|
|
884
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
885
|
+
#[ts(optional, type = "Record<string, unknown>")]
|
|
886
|
+
pub metadata: Option<serde_json::Value>,
|
|
887
|
+
pub created_at: String,
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
891
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
892
|
+
pub struct SessionCreateResponse {
|
|
893
|
+
pub session_id: String,
|
|
894
|
+
pub status: String,
|
|
895
|
+
#[serde(default, skip_serializing_if = "serde_json::Value::is_null")]
|
|
896
|
+
#[ts(type = "Record<string, unknown>")]
|
|
897
|
+
pub signaling: serde_json::Value,
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
901
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
902
|
+
pub struct FileListingResponse {
|
|
903
|
+
pub path: String,
|
|
904
|
+
pub entries: Vec<FileEntry>,
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
908
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
909
|
+
pub struct FileEntry {
|
|
910
|
+
pub name: String,
|
|
911
|
+
#[serde(rename = "type")]
|
|
912
|
+
pub entry_type: String,
|
|
913
|
+
pub size: Option<i64>,
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
917
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
918
|
+
pub struct WebhookInfoItem {
|
|
919
|
+
pub name: String,
|
|
920
|
+
pub url: String,
|
|
921
|
+
pub events: Vec<String>,
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
925
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
926
|
+
pub struct WebhookListResponse {
|
|
927
|
+
pub webhooks: Vec<WebhookInfoItem>,
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
931
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
932
|
+
pub struct DeliveryListResponse {
|
|
933
|
+
#[ts(type = "Array<Record<string, unknown>>")]
|
|
934
|
+
pub deliveries: Vec<serde_json::Value>,
|
|
935
|
+
pub count: usize,
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
939
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
940
|
+
pub struct IpWhitelistResponse {
|
|
941
|
+
pub enabled: bool,
|
|
942
|
+
#[ts(type = "Array<Record<string, unknown>>")]
|
|
943
|
+
pub whitelist: Vec<serde_json::Value>,
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
947
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
948
|
+
pub struct CursorVisibleRange {
|
|
949
|
+
pub start: u32,
|
|
950
|
+
pub end: u32,
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
954
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
955
|
+
pub struct CursorState {
|
|
956
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
957
|
+
#[ts(optional)]
|
|
958
|
+
pub workspace_id: Option<String>,
|
|
959
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
960
|
+
#[ts(optional)]
|
|
961
|
+
pub file: Option<String>,
|
|
962
|
+
pub line: u32,
|
|
963
|
+
pub column: u32,
|
|
964
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
965
|
+
#[ts(optional)]
|
|
966
|
+
pub total_lines: Option<u32>,
|
|
967
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
968
|
+
#[ts(optional)]
|
|
969
|
+
pub language: Option<String>,
|
|
970
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
971
|
+
#[ts(optional)]
|
|
972
|
+
pub visible_range: Option<CursorVisibleRange>,
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
976
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
977
|
+
pub struct WorkspaceSessionResponse {
|
|
978
|
+
pub workspace_id: String,
|
|
979
|
+
pub workspace_path: String,
|
|
980
|
+
pub editor_name: String,
|
|
981
|
+
pub editor_version: String,
|
|
982
|
+
pub git_branch: String,
|
|
983
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
984
|
+
#[ts(optional)]
|
|
985
|
+
pub cursor: Option<CursorState>,
|
|
986
|
+
pub connected_at: String,
|
|
987
|
+
pub last_heartbeat: String,
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
// ── Resource Quotas / Allocation ────────────────────────────
|
|
991
|
+
|
|
992
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
993
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
994
|
+
pub struct ResourceQuota {
|
|
995
|
+
pub id: String,
|
|
996
|
+
pub name: String,
|
|
997
|
+
pub resource_type: String,
|
|
998
|
+
#[ts(type = "number")]
|
|
999
|
+
pub limit_value: f64,
|
|
1000
|
+
pub limit_unit: String,
|
|
1001
|
+
#[ts(type = "number")]
|
|
1002
|
+
pub used_value: f64,
|
|
1003
|
+
pub period: String,
|
|
1004
|
+
pub tier: String,
|
|
1005
|
+
pub enabled: bool,
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
1009
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
1010
|
+
pub struct ResourceQuotaListResponse {
|
|
1011
|
+
pub quotas: Vec<ResourceQuota>,
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
1015
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
1016
|
+
pub struct ResourceUsageSummary {
|
|
1017
|
+
pub resource_type: String,
|
|
1018
|
+
#[ts(type = "number")]
|
|
1019
|
+
pub current_usage: f64,
|
|
1020
|
+
pub unit: String,
|
|
1021
|
+
#[ts(type = "number")]
|
|
1022
|
+
pub limit: f64,
|
|
1023
|
+
pub period: String,
|
|
1024
|
+
#[ts(type = "number")]
|
|
1025
|
+
pub utilization_pct: f64,
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
1029
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
1030
|
+
pub struct ResourceUsageResponse {
|
|
1031
|
+
pub summary: Vec<ResourceUsageSummary>,
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
// ── User Tier / Payment ──────────────────────────────────────
|
|
1035
|
+
|
|
1036
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
1037
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
1038
|
+
pub struct UserTierInfo {
|
|
1039
|
+
pub user_id: String,
|
|
1040
|
+
pub tier: String,
|
|
1041
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
1042
|
+
#[ts(optional)]
|
|
1043
|
+
pub tier_expires_at: Option<String>,
|
|
1044
|
+
#[ts(type = "number")]
|
|
1045
|
+
pub daily_quota_used: f64,
|
|
1046
|
+
#[ts(type = "number")]
|
|
1047
|
+
pub monthly_token_used: f64,
|
|
1048
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
1049
|
+
#[ts(optional)]
|
|
1050
|
+
pub last_quota_reset_at: Option<String>,
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
1054
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
1055
|
+
pub struct TierDefinition {
|
|
1056
|
+
pub tier: String,
|
|
1057
|
+
#[ts(type = "number")]
|
|
1058
|
+
pub daily_request_limit: f64,
|
|
1059
|
+
#[ts(type = "number")]
|
|
1060
|
+
pub monthly_token_limit: f64,
|
|
1061
|
+
#[ts(type = "number")]
|
|
1062
|
+
pub max_sessions: f64,
|
|
1063
|
+
pub price: String,
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
1067
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
1068
|
+
pub struct TierListResponse {
|
|
1069
|
+
pub tiers: Vec<TierDefinition>,
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
#[derive(Debug, Clone, Serialize, TS)]
|
|
1073
|
+
#[ts(export, export_to = "httpTypes.ts")]
|
|
1074
|
+
pub struct UpdateUserTierPayload {
|
|
1075
|
+
pub user_id: String,
|
|
1076
|
+
pub tier: String,
|
|
1077
|
+
}
|