@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/region.rs
ADDED
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
use schemars::JsonSchema;
|
|
2
|
+
use serde::{Deserialize, Serialize};
|
|
3
|
+
use std::fmt;
|
|
4
|
+
use std::str::FromStr;
|
|
5
|
+
use ts_rs::TS;
|
|
6
|
+
|
|
7
|
+
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, TS, JsonSchema, Default)]
|
|
8
|
+
#[ts(export, export_to = "region.ts")]
|
|
9
|
+
#[serde(rename_all = "snake_case")]
|
|
10
|
+
pub enum RegionPolicy {
|
|
11
|
+
China {
|
|
12
|
+
icp_number: Option<String>,
|
|
13
|
+
#[serde(default = "default_true")]
|
|
14
|
+
data_residency_required: bool,
|
|
15
|
+
#[serde(default = "default_true")]
|
|
16
|
+
payment_domestic_only: bool,
|
|
17
|
+
#[serde(default = "default_true")]
|
|
18
|
+
pipi_consent_required: bool,
|
|
19
|
+
},
|
|
20
|
+
EuropeanUnion {
|
|
21
|
+
#[serde(default = "default_true")]
|
|
22
|
+
gdpr_consent_required: bool,
|
|
23
|
+
#[serde(default = "default_true")]
|
|
24
|
+
right_to_deletion: bool,
|
|
25
|
+
#[serde(default = "default_true")]
|
|
26
|
+
right_to_export: bool,
|
|
27
|
+
dpo_contact: Option<String>,
|
|
28
|
+
#[serde(default = "default_true")]
|
|
29
|
+
cookie_consent_required: bool,
|
|
30
|
+
},
|
|
31
|
+
Russia {
|
|
32
|
+
#[serde(default = "default_true")]
|
|
33
|
+
data_localization_required: bool,
|
|
34
|
+
#[serde(default)]
|
|
35
|
+
payment_mir_supported: bool,
|
|
36
|
+
},
|
|
37
|
+
#[default]
|
|
38
|
+
FreeMarket,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
fn default_true() -> bool {
|
|
42
|
+
true
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
impl RegionPolicy {
|
|
46
|
+
pub fn as_str(&self) -> &'static str {
|
|
47
|
+
match self {
|
|
48
|
+
RegionPolicy::China { .. } => "china",
|
|
49
|
+
RegionPolicy::EuropeanUnion { .. } => "european_union",
|
|
50
|
+
RegionPolicy::Russia { .. } => "russia",
|
|
51
|
+
RegionPolicy::FreeMarket => "free_market",
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
pub fn all() -> Vec<RegionPolicy> {
|
|
56
|
+
vec![
|
|
57
|
+
RegionPolicy::China {
|
|
58
|
+
icp_number: None,
|
|
59
|
+
data_residency_required: true,
|
|
60
|
+
payment_domestic_only: true,
|
|
61
|
+
pipi_consent_required: true,
|
|
62
|
+
},
|
|
63
|
+
RegionPolicy::EuropeanUnion {
|
|
64
|
+
gdpr_consent_required: true,
|
|
65
|
+
right_to_deletion: true,
|
|
66
|
+
right_to_export: true,
|
|
67
|
+
dpo_contact: None,
|
|
68
|
+
cookie_consent_required: true,
|
|
69
|
+
},
|
|
70
|
+
RegionPolicy::Russia {
|
|
71
|
+
data_localization_required: true,
|
|
72
|
+
payment_mir_supported: false,
|
|
73
|
+
},
|
|
74
|
+
RegionPolicy::FreeMarket,
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
impl fmt::Display for RegionPolicy {
|
|
80
|
+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
81
|
+
f.write_str(self.as_str())
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
impl FromStr for RegionPolicy {
|
|
86
|
+
type Err = String;
|
|
87
|
+
|
|
88
|
+
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
89
|
+
match s {
|
|
90
|
+
"china" => Ok(RegionPolicy::China {
|
|
91
|
+
icp_number: None,
|
|
92
|
+
data_residency_required: true,
|
|
93
|
+
payment_domestic_only: true,
|
|
94
|
+
pipi_consent_required: true,
|
|
95
|
+
}),
|
|
96
|
+
"european_union" => Ok(RegionPolicy::EuropeanUnion {
|
|
97
|
+
gdpr_consent_required: true,
|
|
98
|
+
right_to_deletion: true,
|
|
99
|
+
right_to_export: true,
|
|
100
|
+
dpo_contact: None,
|
|
101
|
+
cookie_consent_required: true,
|
|
102
|
+
}),
|
|
103
|
+
"russia" => Ok(RegionPolicy::Russia {
|
|
104
|
+
data_localization_required: true,
|
|
105
|
+
payment_mir_supported: false,
|
|
106
|
+
}),
|
|
107
|
+
"free_market" => Ok(RegionPolicy::FreeMarket),
|
|
108
|
+
_ => Err(format!("unknown region policy: {s}")),
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
#[cfg(test)]
|
|
114
|
+
mod tests {
|
|
115
|
+
use super::*;
|
|
116
|
+
|
|
117
|
+
#[test]
|
|
118
|
+
fn china_serde_round_trip() {
|
|
119
|
+
let policy = RegionPolicy::China {
|
|
120
|
+
icp_number: Some("ICP-12345".into()),
|
|
121
|
+
data_residency_required: true,
|
|
122
|
+
payment_domestic_only: true,
|
|
123
|
+
pipi_consent_required: true,
|
|
124
|
+
};
|
|
125
|
+
let json = serde_json::to_string(&policy).unwrap();
|
|
126
|
+
let back: RegionPolicy = serde_json::from_str(&json).unwrap();
|
|
127
|
+
assert_eq!(back, policy);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
#[test]
|
|
131
|
+
fn european_union_serde_round_trip() {
|
|
132
|
+
let policy = RegionPolicy::EuropeanUnion {
|
|
133
|
+
gdpr_consent_required: true,
|
|
134
|
+
right_to_deletion: true,
|
|
135
|
+
right_to_export: false,
|
|
136
|
+
dpo_contact: Some("dpo@example.com".into()),
|
|
137
|
+
cookie_consent_required: true,
|
|
138
|
+
};
|
|
139
|
+
let json = serde_json::to_string(&policy).unwrap();
|
|
140
|
+
let back: RegionPolicy = serde_json::from_str(&json).unwrap();
|
|
141
|
+
assert_eq!(back, policy);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
#[test]
|
|
145
|
+
fn russia_serde_round_trip() {
|
|
146
|
+
let policy = RegionPolicy::Russia {
|
|
147
|
+
data_localization_required: true,
|
|
148
|
+
payment_mir_supported: true,
|
|
149
|
+
};
|
|
150
|
+
let json = serde_json::to_string(&policy).unwrap();
|
|
151
|
+
let back: RegionPolicy = serde_json::from_str(&json).unwrap();
|
|
152
|
+
assert_eq!(back, policy);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
#[test]
|
|
156
|
+
fn free_market_serde_round_trip() {
|
|
157
|
+
let policy = RegionPolicy::FreeMarket;
|
|
158
|
+
let json = serde_json::to_string(&policy).unwrap();
|
|
159
|
+
let back: RegionPolicy = serde_json::from_str(&json).unwrap();
|
|
160
|
+
assert_eq!(back, policy);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
#[test]
|
|
164
|
+
fn default_is_free_market() {
|
|
165
|
+
assert_eq!(RegionPolicy::default(), RegionPolicy::FreeMarket);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
#[test]
|
|
169
|
+
fn display_from_str_roundtrip() {
|
|
170
|
+
for policy in RegionPolicy::all() {
|
|
171
|
+
let s = policy.to_string();
|
|
172
|
+
let back: RegionPolicy = s.parse().unwrap();
|
|
173
|
+
assert_eq!(back, policy, "roundtrip failed for {s}");
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
#[test]
|
|
178
|
+
fn from_str_rejects_unknown() {
|
|
179
|
+
assert!(RegionPolicy::from_str("unknown").is_err());
|
|
180
|
+
assert!(RegionPolicy::from_str("").is_err());
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
#[test]
|
|
184
|
+
fn all_returns_four_unique_variants() {
|
|
185
|
+
let all = RegionPolicy::all();
|
|
186
|
+
assert_eq!(
|
|
187
|
+
all.len(),
|
|
188
|
+
4,
|
|
189
|
+
"RegionPolicy::all() must return exactly 4 variants"
|
|
190
|
+
);
|
|
191
|
+
let mut seen = std::collections::HashSet::new();
|
|
192
|
+
for p in &all {
|
|
193
|
+
let s = p.as_str();
|
|
194
|
+
assert!(seen.insert(s), "duplicate region policy: {s}");
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
#[test]
|
|
199
|
+
fn china_default_flags() {
|
|
200
|
+
let policy = RegionPolicy::China {
|
|
201
|
+
icp_number: None,
|
|
202
|
+
data_residency_required: true,
|
|
203
|
+
payment_domestic_only: true,
|
|
204
|
+
pipi_consent_required: true,
|
|
205
|
+
};
|
|
206
|
+
match policy {
|
|
207
|
+
RegionPolicy::China {
|
|
208
|
+
data_residency_required,
|
|
209
|
+
payment_domestic_only,
|
|
210
|
+
pipi_consent_required,
|
|
211
|
+
icp_number,
|
|
212
|
+
} => {
|
|
213
|
+
assert!(data_residency_required);
|
|
214
|
+
assert!(payment_domestic_only);
|
|
215
|
+
assert!(pipi_consent_required);
|
|
216
|
+
assert!(icp_number.is_none());
|
|
217
|
+
}
|
|
218
|
+
_ => unreachable!(),
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
#[test]
|
|
223
|
+
fn eu_default_flags() {
|
|
224
|
+
let policy = RegionPolicy::EuropeanUnion {
|
|
225
|
+
gdpr_consent_required: true,
|
|
226
|
+
right_to_deletion: true,
|
|
227
|
+
right_to_export: true,
|
|
228
|
+
dpo_contact: None,
|
|
229
|
+
cookie_consent_required: true,
|
|
230
|
+
};
|
|
231
|
+
match policy {
|
|
232
|
+
RegionPolicy::EuropeanUnion {
|
|
233
|
+
gdpr_consent_required,
|
|
234
|
+
right_to_deletion,
|
|
235
|
+
right_to_export,
|
|
236
|
+
cookie_consent_required,
|
|
237
|
+
dpo_contact,
|
|
238
|
+
} => {
|
|
239
|
+
assert!(gdpr_consent_required);
|
|
240
|
+
assert!(right_to_deletion);
|
|
241
|
+
assert!(right_to_export);
|
|
242
|
+
assert!(cookie_consent_required);
|
|
243
|
+
assert!(dpo_contact.is_none());
|
|
244
|
+
}
|
|
245
|
+
_ => unreachable!(),
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
#[test]
|
|
250
|
+
fn russia_default_flags() {
|
|
251
|
+
let policy = RegionPolicy::Russia {
|
|
252
|
+
data_localization_required: true,
|
|
253
|
+
payment_mir_supported: false,
|
|
254
|
+
};
|
|
255
|
+
match policy {
|
|
256
|
+
RegionPolicy::Russia {
|
|
257
|
+
data_localization_required,
|
|
258
|
+
payment_mir_supported,
|
|
259
|
+
} => {
|
|
260
|
+
assert!(data_localization_required);
|
|
261
|
+
assert!(!payment_mir_supported);
|
|
262
|
+
}
|
|
263
|
+
_ => unreachable!(),
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
#[test]
|
|
268
|
+
fn china_deser_fills_defaults() {
|
|
269
|
+
let json = r#"{"china": {"icp_number": null}}"#;
|
|
270
|
+
let policy: RegionPolicy = serde_json::from_str(json).unwrap();
|
|
271
|
+
match policy {
|
|
272
|
+
RegionPolicy::China {
|
|
273
|
+
data_residency_required,
|
|
274
|
+
payment_domestic_only,
|
|
275
|
+
pipi_consent_required,
|
|
276
|
+
..
|
|
277
|
+
} => {
|
|
278
|
+
assert!(data_residency_required);
|
|
279
|
+
assert!(payment_domestic_only);
|
|
280
|
+
assert!(pipi_consent_required);
|
|
281
|
+
}
|
|
282
|
+
_ => panic!("expected China"),
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
#[test]
|
|
287
|
+
fn eu_deser_fills_defaults() {
|
|
288
|
+
let json = r#"{"european_union": {}}"#;
|
|
289
|
+
let policy: RegionPolicy = serde_json::from_str(json).unwrap();
|
|
290
|
+
match policy {
|
|
291
|
+
RegionPolicy::EuropeanUnion {
|
|
292
|
+
gdpr_consent_required,
|
|
293
|
+
right_to_deletion,
|
|
294
|
+
right_to_export,
|
|
295
|
+
cookie_consent_required,
|
|
296
|
+
..
|
|
297
|
+
} => {
|
|
298
|
+
assert!(gdpr_consent_required);
|
|
299
|
+
assert!(right_to_deletion);
|
|
300
|
+
assert!(right_to_export);
|
|
301
|
+
assert!(cookie_consent_required);
|
|
302
|
+
}
|
|
303
|
+
_ => panic!("expected EuropeanUnion"),
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
#[test]
|
|
308
|
+
fn russia_deser_fills_defaults() {
|
|
309
|
+
let json = r#"{"russia": {}}"#;
|
|
310
|
+
let policy: RegionPolicy = serde_json::from_str(json).unwrap();
|
|
311
|
+
match policy {
|
|
312
|
+
RegionPolicy::Russia {
|
|
313
|
+
data_localization_required,
|
|
314
|
+
payment_mir_supported,
|
|
315
|
+
} => {
|
|
316
|
+
assert!(data_localization_required);
|
|
317
|
+
assert!(!payment_mir_supported);
|
|
318
|
+
}
|
|
319
|
+
_ => panic!("expected Russia"),
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
#[test]
|
|
324
|
+
fn as_str_all_variants() {
|
|
325
|
+
assert_eq!(
|
|
326
|
+
RegionPolicy::China {
|
|
327
|
+
icp_number: None,
|
|
328
|
+
data_residency_required: true,
|
|
329
|
+
payment_domestic_only: true,
|
|
330
|
+
pipi_consent_required: true
|
|
331
|
+
}
|
|
332
|
+
.as_str(),
|
|
333
|
+
"china"
|
|
334
|
+
);
|
|
335
|
+
assert_eq!(
|
|
336
|
+
RegionPolicy::EuropeanUnion {
|
|
337
|
+
gdpr_consent_required: true,
|
|
338
|
+
right_to_deletion: true,
|
|
339
|
+
right_to_export: true,
|
|
340
|
+
dpo_contact: None,
|
|
341
|
+
cookie_consent_required: true
|
|
342
|
+
}
|
|
343
|
+
.as_str(),
|
|
344
|
+
"european_union"
|
|
345
|
+
);
|
|
346
|
+
assert_eq!(
|
|
347
|
+
RegionPolicy::Russia {
|
|
348
|
+
data_localization_required: true,
|
|
349
|
+
payment_mir_supported: false
|
|
350
|
+
}
|
|
351
|
+
.as_str(),
|
|
352
|
+
"russia"
|
|
353
|
+
);
|
|
354
|
+
assert_eq!(RegionPolicy::FreeMarket.as_str(), "free_market");
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
#[test]
|
|
358
|
+
fn free_market_serializes_as_snake_case_string() {
|
|
359
|
+
let json = serde_json::to_string(&RegionPolicy::FreeMarket).unwrap();
|
|
360
|
+
assert_eq!(json, r#""free_market""#);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#[derive(Debug, Clone, Copy, Default)]
|
|
2
|
+
pub struct ShortTimer;
|
|
3
|
+
|
|
4
|
+
impl tracing_subscriber::fmt::time::FormatTime for ShortTimer {
|
|
5
|
+
fn format_time(&self, w: &mut tracing_subscriber::fmt::format::Writer<'_>) -> std::fmt::Result {
|
|
6
|
+
let now = chrono::Local::now();
|
|
7
|
+
write!(w, "{}", now.format("%H:%M:%S"))
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
//! Agent lifecycle — streaming, responses, reports, orchestration, snapshots.
|
|
2
|
+
|
|
3
|
+
use schemars::JsonSchema;
|
|
4
|
+
use serde::{Deserialize, Serialize};
|
|
5
|
+
use ts_rs::TS;
|
|
6
|
+
|
|
7
|
+
use crate::{
|
|
8
|
+
Agent, AgentBadge, AgentStatus, CompletionOutcome, LlmStream, ModelTier, ReportSelection,
|
|
9
|
+
ReportType, RequestState, RouteInfo, SkillStage, StreamChunkKind, StructuredAgentError,
|
|
10
|
+
WorkStatus,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// ═══════════════════════════════════════════════════════════════
|
|
14
|
+
// Agent lifecycle
|
|
15
|
+
// ═══════════════════════════════════════════════════════════════
|
|
16
|
+
|
|
17
|
+
#[derive(JsonSchema, Debug, Clone, Serialize, Deserialize, TS)]
|
|
18
|
+
#[ts(export, export_to = "ws/agentLifecycle.ts")]
|
|
19
|
+
pub struct AgentStreamingChunkParams {
|
|
20
|
+
pub agent_type: Agent,
|
|
21
|
+
pub agent_id: String,
|
|
22
|
+
#[serde(default)]
|
|
23
|
+
#[ts(type = "string")]
|
|
24
|
+
#[ts(optional)]
|
|
25
|
+
pub agent_number: Option<AgentBadge>,
|
|
26
|
+
pub chunk: String,
|
|
27
|
+
pub is_done: bool,
|
|
28
|
+
pub timestamp: String,
|
|
29
|
+
#[serde(default)]
|
|
30
|
+
#[ts(optional)]
|
|
31
|
+
pub task_id: Option<String>,
|
|
32
|
+
#[serde(default)]
|
|
33
|
+
#[ts(optional)]
|
|
34
|
+
pub chunk_kind: Option<StreamChunkKind>,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
|
|
38
|
+
#[ts(export, export_to = "ws/agentLifecycle.ts")]
|
|
39
|
+
pub struct AgentResponseParams {
|
|
40
|
+
pub agent_type: Agent,
|
|
41
|
+
pub agent_id: String,
|
|
42
|
+
#[serde(default)]
|
|
43
|
+
#[ts(type = "string")]
|
|
44
|
+
#[ts(optional)]
|
|
45
|
+
pub agent_number: Option<AgentBadge>,
|
|
46
|
+
pub content: String,
|
|
47
|
+
pub timestamp: String,
|
|
48
|
+
#[serde(default)]
|
|
49
|
+
#[ts(optional)]
|
|
50
|
+
pub parent_id: Option<String>,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
|
|
54
|
+
#[ts(export, export_to = "ws/agentLifecycle.ts")]
|
|
55
|
+
pub struct AgentReportParams {
|
|
56
|
+
pub report_type: ReportType,
|
|
57
|
+
pub agent_type: Agent,
|
|
58
|
+
pub agent_id: String,
|
|
59
|
+
#[serde(default)]
|
|
60
|
+
#[ts(type = "string")]
|
|
61
|
+
#[ts(optional)]
|
|
62
|
+
pub agent_number: Option<AgentBadge>,
|
|
63
|
+
pub title: String,
|
|
64
|
+
pub content: String,
|
|
65
|
+
#[serde(default)]
|
|
66
|
+
#[ts(optional)]
|
|
67
|
+
pub summary: Option<String>,
|
|
68
|
+
pub timestamp: String,
|
|
69
|
+
#[serde(default)]
|
|
70
|
+
pub preset_options: Vec<String>,
|
|
71
|
+
/// For `report_type: "query"`: whether `preset_options` are mutually
|
|
72
|
+
/// exclusive (single) or pick-any (multiple). Omit ⇒ single.
|
|
73
|
+
#[serde(default)]
|
|
74
|
+
#[ts(optional)]
|
|
75
|
+
pub selection_mode: Option<ReportSelection>,
|
|
76
|
+
/// For `report_type: "query"`: whether the recipient may type a free-form
|
|
77
|
+
/// answer in addition to (or instead of) picking presets. Omit ⇒ true
|
|
78
|
+
/// when `report_type == Query`, false otherwise.
|
|
79
|
+
#[serde(default)]
|
|
80
|
+
#[ts(optional)]
|
|
81
|
+
pub allow_custom_reply: Option<bool>,
|
|
82
|
+
/// Subset of `preset_options` the agent suggests. Empty when no
|
|
83
|
+
/// recommendation is offered.
|
|
84
|
+
#[serde(default)]
|
|
85
|
+
pub recommended_options: Vec<String>,
|
|
86
|
+
#[serde(default)]
|
|
87
|
+
#[ts(optional)]
|
|
88
|
+
pub model_name: Option<String>,
|
|
89
|
+
#[serde(default)]
|
|
90
|
+
#[ts(optional)]
|
|
91
|
+
pub token_usage: Option<(u32, u32)>,
|
|
92
|
+
#[serde(default)]
|
|
93
|
+
#[ts(optional)]
|
|
94
|
+
pub skill_count: Option<u32>,
|
|
95
|
+
#[serde(default)]
|
|
96
|
+
#[ts(optional)]
|
|
97
|
+
pub mcp_count: Option<u32>,
|
|
98
|
+
#[serde(default)]
|
|
99
|
+
#[ts(optional)]
|
|
100
|
+
pub next_route: Option<RouteInfo>,
|
|
101
|
+
#[serde(default)]
|
|
102
|
+
#[ts(optional)]
|
|
103
|
+
pub stream: Option<LlmStream>,
|
|
104
|
+
#[serde(default)]
|
|
105
|
+
#[ts(optional)]
|
|
106
|
+
pub error: Option<StructuredAgentError>,
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/// Reply payload for an inquiry (`report_type: "query"`) report.
|
|
110
|
+
///
|
|
111
|
+
/// Wire method: `Sync.AgentReportReply` (server-bound). `report_id` mirrors
|
|
112
|
+
/// the `agent_id` of the originating `AgentReportParams` so the upstream can
|
|
113
|
+
/// correlate without keeping a separate consultation registry.
|
|
114
|
+
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
|
|
115
|
+
#[ts(export, export_to = "ws/agentLifecycle.ts")]
|
|
116
|
+
pub struct AgentReportReplyParams {
|
|
117
|
+
pub report_id: String,
|
|
118
|
+
#[serde(default)]
|
|
119
|
+
pub selected_options: Vec<String>,
|
|
120
|
+
#[serde(default)]
|
|
121
|
+
#[ts(optional)]
|
|
122
|
+
pub custom_answer: Option<String>,
|
|
123
|
+
pub timestamp: String,
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
|
|
127
|
+
#[ts(export, export_to = "ws/agentLifecycle.ts")]
|
|
128
|
+
pub struct OrchestrationStatusParams {
|
|
129
|
+
pub stage: SkillStage,
|
|
130
|
+
pub agent: String,
|
|
131
|
+
#[serde(default)]
|
|
132
|
+
#[ts(optional)]
|
|
133
|
+
pub agent_type: Option<Agent>,
|
|
134
|
+
#[serde(default)]
|
|
135
|
+
#[ts(optional)]
|
|
136
|
+
pub tool_name: Option<String>,
|
|
137
|
+
#[serde(default)]
|
|
138
|
+
#[ts(type = "string")]
|
|
139
|
+
#[ts(optional)]
|
|
140
|
+
pub call_id: Option<uuid::Uuid>,
|
|
141
|
+
#[serde(default)]
|
|
142
|
+
#[ts(type = "string")]
|
|
143
|
+
#[ts(optional)]
|
|
144
|
+
pub parent_agent: Option<uuid::Uuid>,
|
|
145
|
+
#[serde(default)]
|
|
146
|
+
#[ts(optional)]
|
|
147
|
+
pub parameters_summary: Option<String>,
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
#[derive(JsonSchema, Debug, Clone, Serialize, Deserialize, TS)]
|
|
151
|
+
#[ts(export, export_to = "ws/agentLifecycle.ts")]
|
|
152
|
+
pub struct McpToolResultParams {
|
|
153
|
+
pub tool_name: String,
|
|
154
|
+
#[ts(type = "string")]
|
|
155
|
+
pub call_id: uuid::Uuid,
|
|
156
|
+
#[serde(default)]
|
|
157
|
+
#[ts(optional)]
|
|
158
|
+
pub parameters_summary: Option<String>,
|
|
159
|
+
pub result: String,
|
|
160
|
+
pub agent_type: Agent,
|
|
161
|
+
pub agent_id: String,
|
|
162
|
+
#[serde(default)]
|
|
163
|
+
#[ts(type = "string")]
|
|
164
|
+
#[ts(optional)]
|
|
165
|
+
pub agent_number: Option<AgentBadge>,
|
|
166
|
+
pub success: bool,
|
|
167
|
+
#[serde(default)]
|
|
168
|
+
#[ts(optional)]
|
|
169
|
+
pub duration_ms: Option<u64>,
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// ═══════════════════════════════════════════════════════════════
|
|
173
|
+
// Agent list / snapshot
|
|
174
|
+
// ═══════════════════════════════════════════════════════════════
|
|
175
|
+
|
|
176
|
+
#[derive(JsonSchema, Debug, Clone, Serialize, Deserialize, TS)]
|
|
177
|
+
#[ts(export, export_to = "ws/agentLifecycle.ts")]
|
|
178
|
+
pub struct TuiAgentInfo {
|
|
179
|
+
pub agent_type: Agent,
|
|
180
|
+
#[serde(default)]
|
|
181
|
+
#[ts(type = "string")]
|
|
182
|
+
#[ts(optional)]
|
|
183
|
+
pub agent_number: Option<AgentBadge>,
|
|
184
|
+
#[serde(default)]
|
|
185
|
+
#[ts(optional)]
|
|
186
|
+
pub agent_uuid: Option<String>,
|
|
187
|
+
pub agent_id: String,
|
|
188
|
+
pub status: AgentStatus,
|
|
189
|
+
pub llm_working: bool,
|
|
190
|
+
pub cpu_usage: f64,
|
|
191
|
+
pub memory_mb: u64,
|
|
192
|
+
#[serde(default)]
|
|
193
|
+
#[ts(optional)]
|
|
194
|
+
pub parent_id: Option<String>,
|
|
195
|
+
#[serde(default)]
|
|
196
|
+
#[ts(optional)]
|
|
197
|
+
pub work_status: Option<WorkStatus>,
|
|
198
|
+
#[serde(default)]
|
|
199
|
+
#[ts(optional)]
|
|
200
|
+
pub current_model: Option<String>,
|
|
201
|
+
#[serde(default)]
|
|
202
|
+
#[ts(optional)]
|
|
203
|
+
pub model_tier: Option<ModelTier>,
|
|
204
|
+
#[serde(default)]
|
|
205
|
+
#[ts(optional)]
|
|
206
|
+
pub llm_handle: Option<String>,
|
|
207
|
+
#[serde(default)]
|
|
208
|
+
#[ts(optional)]
|
|
209
|
+
pub token_usage: Option<(u32, u32)>,
|
|
210
|
+
pub mcp_tool_calls: u32,
|
|
211
|
+
pub request_state: RequestState,
|
|
212
|
+
pub completion_outcome: CompletionOutcome,
|
|
213
|
+
pub retry_count: u32,
|
|
214
|
+
pub max_retries: u32,
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
|
|
218
|
+
#[ts(export, export_to = "ws/agentLifecycle.ts")]
|
|
219
|
+
pub struct AgentListResponseParams {
|
|
220
|
+
pub agents: Vec<TuiAgentInfo>,
|
|
221
|
+
}
|