@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.
Files changed (96) hide show
  1. package/Cargo.toml +38 -0
  2. package/bindings/FileAnchor.ts +3 -0
  3. package/bindings/engine.ts +277 -0
  4. package/bindings/enums.ts +31 -0
  5. package/bindings/httpTypes.ts +197 -0
  6. package/bindings/index.ts +47 -0
  7. package/bindings/mcp/aporia.ts +61 -0
  8. package/bindings/mcp/eleos.ts +18 -0
  9. package/bindings/mcp/epieikeia.ts +48 -0
  10. package/bindings/mcp/haplotes.ts +47 -0
  11. package/bindings/mcp/hubris.ts +41 -0
  12. package/bindings/mcp/index.ts +13 -0
  13. package/bindings/mcp/kalos.ts +47 -0
  14. package/bindings/mcp/neikos.ts +76 -0
  15. package/bindings/mcp/orexis.ts +64 -0
  16. package/bindings/mcp/philia.ts +57 -0
  17. package/bindings/mcp/polemos.ts +55 -0
  18. package/bindings/mcp/skemma.ts +58 -0
  19. package/bindings/mcp/skopeo.ts +56 -0
  20. package/bindings/mcp/webAutomation.ts +31 -0
  21. package/bindings/model.ts +240 -0
  22. package/bindings/package.json +16 -0
  23. package/bindings/region.ts +3 -0
  24. package/bindings/serde_json/JsonValue.ts +3 -0
  25. package/bindings/ws/agentLifecycle.ts +41 -0
  26. package/bindings/ws/auth.ts +15 -0
  27. package/bindings/ws/baseMessages.ts +7 -0
  28. package/bindings/ws/bridgeNetwork.ts +71 -0
  29. package/bindings/ws/core.ts +51 -0
  30. package/bindings/ws/fileBrowsing.ts +57 -0
  31. package/bindings/ws/handshake.ts +23 -0
  32. package/bindings/ws/industrial.ts +72 -0
  33. package/bindings/ws/knowledgeBase.ts +10 -0
  34. package/bindings/ws/layer2.ts +25 -0
  35. package/bindings/ws/llmProvider.ts +74 -0
  36. package/bindings/ws/logs.ts +11 -0
  37. package/bindings/ws/malkuth.ts +62 -0
  38. package/bindings/ws/noa.ts +17 -0
  39. package/bindings/ws/stateSync.ts +19 -0
  40. package/bindings/ws/systemUi.ts +5 -0
  41. package/bindings/ws/tasks.ts +6 -0
  42. package/bindings/ws/views.ts +163 -0
  43. package/bindings/ws/workspace.ts +11 -0
  44. package/bindings/ws/yolo.ts +32 -0
  45. package/examples/schema_dump.rs +51 -0
  46. package/package.json +6 -0
  47. package/pnpm-workspace.yaml +2 -0
  48. package/src/engine.rs +602 -0
  49. package/src/enums.rs +334 -0
  50. package/src/external_mcp.rs +132 -0
  51. package/src/http.rs +1077 -0
  52. package/src/identity.rs +160 -0
  53. package/src/lib.rs +1215 -0
  54. package/src/malkuth.rs +145 -0
  55. package/src/mcp/aporia.rs +272 -0
  56. package/src/mcp/eleos.rs +210 -0
  57. package/src/mcp/epieikeia.rs +194 -0
  58. package/src/mcp/haplotes.rs +310 -0
  59. package/src/mcp/hubris.rs +377 -0
  60. package/src/mcp/kalos.rs +251 -0
  61. package/src/mcp/mod.rs +23 -0
  62. package/src/mcp/neikos.rs +533 -0
  63. package/src/mcp/orexis.rs +493 -0
  64. package/src/mcp/philia.rs +267 -0
  65. package/src/mcp/polemos.rs +241 -0
  66. package/src/mcp/skemma.rs +442 -0
  67. package/src/mcp/skopeo.rs +282 -0
  68. package/src/mcp/web_automation.rs +122 -0
  69. package/src/model.rs +421 -0
  70. package/src/protocol/base_messages.rs +125 -0
  71. package/src/protocol/handshake.rs +364 -0
  72. package/src/protocol/jsonrpc.rs +888 -0
  73. package/src/protocol/mod.rs +10 -0
  74. package/src/rbac.rs +786 -0
  75. package/src/region.rs +362 -0
  76. package/src/tracing_helpers.rs +9 -0
  77. package/src/ws/agent/agent_lifecycle.rs +221 -0
  78. package/src/ws/agent/layer2.rs +126 -0
  79. package/src/ws/agent/mod.rs +9 -0
  80. package/src/ws/agent/state_sync.rs +111 -0
  81. package/src/ws/agent/tasks.rs +43 -0
  82. package/src/ws/agent/yolo.rs +161 -0
  83. package/src/ws/mod.rs +10 -0
  84. package/src/ws/services/auth.rs +99 -0
  85. package/src/ws/services/industrial.rs +647 -0
  86. package/src/ws/services/knowledge_base.rs +59 -0
  87. package/src/ws/services/llm_provider.rs +371 -0
  88. package/src/ws/services/mod.rs +7 -0
  89. package/src/ws/ui/bridge_network.rs +96 -0
  90. package/src/ws/ui/file_browsing.rs +88 -0
  91. package/src/ws/ui/logs.rs +55 -0
  92. package/src/ws/ui/mod.rs +11 -0
  93. package/src/ws/ui/noa.rs +105 -0
  94. package/src/ws/ui/system_ui.rs +27 -0
  95. package/src/ws/ui/views.rs +159 -0
  96. package/src/ws/ui/workspace.rs +73 -0
@@ -0,0 +1,442 @@
1
+ use uuid::Uuid;
2
+
3
+ use crate::enums::ScriptLanguage;
4
+
5
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
6
+ #[ts(export, export_to = "mcp/skemma.ts")]
7
+ pub struct ScriptExecResult {
8
+ pub language: ScriptLanguage,
9
+ pub execution_id: Uuid,
10
+ pub exit_code: i32,
11
+ pub duration_ms: u64,
12
+ pub stdout: String,
13
+ pub stderr: String,
14
+ }
15
+
16
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
17
+ #[ts(export, export_to = "mcp/skemma.ts")]
18
+ pub struct Layer2ScriptExecResult {
19
+ pub language: ScriptLanguage,
20
+ pub agent: String,
21
+ pub tool: String,
22
+ pub execution_id: Uuid,
23
+ pub exit_code: i32,
24
+ pub duration_ms: u64,
25
+ pub output: String,
26
+ }
27
+
28
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
29
+ #[ts(export, export_to = "mcp/skemma.ts")]
30
+ pub struct RemoteConnectionInfo {
31
+ pub id: String,
32
+ pub host: String,
33
+ pub port: u16,
34
+ pub protocol: String,
35
+ pub connected: bool,
36
+ pub connected_at: Option<String>,
37
+ }
38
+
39
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
40
+ #[ts(export, export_to = "mcp/skemma.ts")]
41
+ pub struct ListRemotesResult {
42
+ pub remotes: Vec<RemoteConnectionInfo>,
43
+ pub total: usize,
44
+ }
45
+
46
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
47
+ #[ts(export, export_to = "mcp/skemma.ts")]
48
+ pub struct ConnectRemoteResult {
49
+ pub id: String,
50
+ pub host: String,
51
+ pub port: u16,
52
+ pub protocol: String,
53
+ pub connected: bool,
54
+ pub message: String,
55
+ }
56
+
57
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
58
+ #[ts(export, export_to = "mcp/skemma.ts")]
59
+ pub struct DisconnectRemoteResult {
60
+ pub disconnected: bool,
61
+ pub remote_id: String,
62
+ }
63
+
64
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
65
+ #[ts(export, export_to = "mcp/skemma.ts")]
66
+ pub struct ExecOnRemoteResult {
67
+ pub remote_id: String,
68
+ pub command: String,
69
+ pub exit_code: i32,
70
+ pub stdout: String,
71
+ pub stderr: String,
72
+ pub duration_ms: u64,
73
+ }
74
+
75
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
76
+ #[ts(export, export_to = "mcp/skemma.ts")]
77
+ pub struct ScreenshotResult {
78
+ pub remote_id: String,
79
+ pub width: u32,
80
+ pub height: u32,
81
+ pub format: String,
82
+ pub data_base64: String,
83
+ }
84
+
85
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
86
+ #[ts(export, export_to = "mcp/skemma.ts")]
87
+ pub struct MouseOperateResult {
88
+ pub remote_id: String,
89
+ pub action: String,
90
+ pub x: i32,
91
+ pub y: i32,
92
+ pub button: String,
93
+ pub success: bool,
94
+ }
95
+
96
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
97
+ #[ts(export, export_to = "mcp/skemma.ts")]
98
+ pub struct KeyboardOperateResult {
99
+ pub remote_id: String,
100
+ pub action: String,
101
+ pub keys: Vec<String>,
102
+ pub success: bool,
103
+ }
104
+
105
+ // ── Tool parameter structs (for .d.ts API signature generation) ──
106
+
107
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
108
+ #[ts(export, export_to = "mcp/skemma.ts")]
109
+ pub struct ModbusScanConfig {
110
+ pub address: u16,
111
+ pub count: u16,
112
+ #[serde(default, skip_serializing_if = "Option::is_none")]
113
+ pub function_code: Option<u8>,
114
+ }
115
+
116
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
117
+ #[ts(export, export_to = "mcp/skemma.ts")]
118
+ pub struct ModbusWriteConfig {
119
+ pub address: u16,
120
+ pub value: u16,
121
+ #[serde(default, skip_serializing_if = "Option::is_none")]
122
+ pub function_code: Option<u8>,
123
+ }
124
+
125
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
126
+ #[ts(export, export_to = "mcp/skemma.ts")]
127
+ pub struct ScriptExecParams {
128
+ pub code: String,
129
+ pub language: Option<String>,
130
+ pub timeout: Option<u64>,
131
+ }
132
+
133
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
134
+ #[ts(export, export_to = "mcp/skemma.ts")]
135
+ pub struct ModbusReadParams {
136
+ pub endpoint: String,
137
+ pub station: Option<u16>,
138
+ pub scan: Option<Vec<ModbusScanConfig>>,
139
+ pub register_type: Option<String>,
140
+ pub start_address: Option<u64>,
141
+ pub count: Option<u64>,
142
+ }
143
+
144
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
145
+ #[ts(export, export_to = "mcp/skemma.ts")]
146
+ pub struct ModbusWriteParams {
147
+ pub endpoint: String,
148
+ pub station: Option<u16>,
149
+ pub writes: Option<Vec<ModbusWriteConfig>>,
150
+ pub register_type: Option<String>,
151
+ pub start_address: Option<u64>,
152
+ pub values: Vec<u64>,
153
+ }
154
+
155
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
156
+ #[ts(export, export_to = "mcp/skemma.ts")]
157
+ pub struct SignalNormalizeParams {
158
+ pub values: Vec<f64>,
159
+ pub method: Option<String>,
160
+ pub signed: Option<bool>,
161
+ }
162
+
163
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
164
+ #[ts(export, export_to = "mcp/skemma.ts")]
165
+ pub struct ConnectRemoteViaSshParams {
166
+ pub host: String,
167
+ pub port: Option<u64>,
168
+ pub username: Option<String>,
169
+ }
170
+
171
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
172
+ #[ts(export, export_to = "mcp/skemma.ts")]
173
+ pub struct ExecOnRemoteParams {
174
+ pub remote_id: String,
175
+ pub command: String,
176
+ }
177
+
178
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
179
+ #[ts(export, export_to = "mcp/skemma.ts")]
180
+ pub struct ScreenshotParams {
181
+ pub remote_id: String,
182
+ pub width: Option<u64>,
183
+ pub height: Option<u64>,
184
+ }
185
+
186
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
187
+ #[ts(export, export_to = "mcp/skemma.ts")]
188
+ pub struct MouseOperateParams {
189
+ pub remote_id: String,
190
+ pub action: Option<String>,
191
+ pub x: Option<i64>,
192
+ pub y: Option<i64>,
193
+ pub button: Option<String>,
194
+ }
195
+
196
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
197
+ #[ts(export, export_to = "mcp/skemma.ts")]
198
+ pub struct KeyboardOperateParams {
199
+ pub remote_id: String,
200
+ pub action: Option<String>,
201
+ pub keys: Vec<String>,
202
+ }
203
+
204
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
205
+ #[ts(export, export_to = "mcp/skemma.ts")]
206
+ pub struct DisconnectRemoteParams {
207
+ pub remote_id: String,
208
+ }
209
+
210
+ // ── Tool result structs (signal/modbus/opcua) ──
211
+
212
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
213
+ #[ts(export, export_to = "mcp/skemma.ts")]
214
+ pub struct SignalStats {
215
+ pub min: f64,
216
+ pub max: f64,
217
+ pub mean: f64,
218
+ pub std_dev: f64,
219
+ }
220
+
221
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
222
+ #[ts(export, export_to = "mcp/skemma.ts")]
223
+ pub struct SignalNormalizeResult {
224
+ pub method: String,
225
+ pub input_count: usize,
226
+ pub output: Vec<f64>,
227
+ pub stats: SignalStats,
228
+ }
229
+
230
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
231
+ #[ts(export, export_to = "mcp/skemma.ts")]
232
+ pub struct RegisterRangeResult {
233
+ pub register_type: String,
234
+ pub start_address: u16,
235
+ pub count: u16,
236
+ pub values: Vec<u16>,
237
+ pub raw_bytes: Vec<String>,
238
+ }
239
+
240
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
241
+ #[ts(export, export_to = "mcp/skemma.ts")]
242
+ pub struct ModbusReadResult {
243
+ pub station: u16,
244
+ pub transport: String,
245
+ pub endpoint: String,
246
+ pub results: Vec<RegisterRangeResult>,
247
+ pub total_registers: usize,
248
+ }
249
+
250
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
251
+ #[ts(export, export_to = "mcp/skemma.ts")]
252
+ pub struct WriteRangeResult {
253
+ pub register_type: String,
254
+ pub start_address: u16,
255
+ pub count: u16,
256
+ pub confirmed: bool,
257
+ }
258
+
259
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
260
+ #[ts(export, export_to = "mcp/skemma.ts")]
261
+ pub struct ModbusWriteResult {
262
+ pub station: u16,
263
+ pub transport: String,
264
+ pub endpoint: String,
265
+ pub writes: Vec<WriteRangeResult>,
266
+ pub total_written: usize,
267
+ pub all_confirmed: bool,
268
+ }
269
+
270
+ #[cfg(test)]
271
+ mod tests {
272
+ use super::*;
273
+ use crate::enums::ScriptLanguage;
274
+
275
+ #[test]
276
+ fn script_exec_result_round_trip() {
277
+ let r = ScriptExecResult {
278
+ language: ScriptLanguage::Bash,
279
+ execution_id: Uuid::new_v4(),
280
+ exit_code: 0,
281
+ duration_ms: 1500,
282
+ stdout: "hello\n".into(),
283
+ stderr: String::new(),
284
+ };
285
+ let v = serde_json::to_value(&r).unwrap();
286
+ // ScriptLanguage serializes as PascalCase variant name (serde default).
287
+ assert_eq!(v["language"], "Bash");
288
+ assert_eq!(v["exit_code"], 0);
289
+ assert_eq!(v["duration_ms"], 1500);
290
+ let back: ScriptExecResult = serde_json::from_value(v).unwrap();
291
+ assert_eq!(back.language, ScriptLanguage::Bash);
292
+ }
293
+
294
+ #[test]
295
+ fn remote_connection_info_round_trip() {
296
+ let r = RemoteConnectionInfo {
297
+ id: "ssh-1".into(),
298
+ host: "192.168.1.10".into(),
299
+ port: 22,
300
+ protocol: "ssh".into(),
301
+ connected: true,
302
+ connected_at: Some("2026-01-01T00:00:00Z".into()),
303
+ };
304
+ let v = serde_json::to_value(&r).unwrap();
305
+ assert_eq!(v["port"], 22);
306
+ assert_eq!(v["connected_at"], "2026-01-01T00:00:00Z");
307
+ let back: RemoteConnectionInfo = serde_json::from_value(v).unwrap();
308
+ assert!(back.connected);
309
+ }
310
+
311
+ #[test]
312
+ fn remote_connection_info_no_connected_at() {
313
+ let r = RemoteConnectionInfo {
314
+ id: "x".into(),
315
+ host: "h".into(),
316
+ port: 22,
317
+ protocol: "ssh".into(),
318
+ connected: false,
319
+ connected_at: None,
320
+ };
321
+ let v = serde_json::to_value(&r).unwrap();
322
+ assert_eq!(v["connected_at"], serde_json::Value::Null);
323
+ }
324
+
325
+ #[test]
326
+ fn screenshot_result_round_trip() {
327
+ let r = ScreenshotResult {
328
+ remote_id: "ssh-1".into(),
329
+ width: 1920,
330
+ height: 1080,
331
+ format: "png".into(),
332
+ data_base64: "iVBORw0KGgo=".into(),
333
+ };
334
+ let v = serde_json::to_value(&r).unwrap();
335
+ assert_eq!(v["width"], 1920);
336
+ assert_eq!(v["format"], "png");
337
+ let back: ScreenshotResult = serde_json::from_value(v).unwrap();
338
+ assert_eq!(back.data_base64, "iVBORw0KGgo=");
339
+ }
340
+
341
+ #[test]
342
+ fn modbus_read_result_round_trip() {
343
+ let r = ModbusReadResult {
344
+ station: 1,
345
+ transport: "tcp".into(),
346
+ endpoint: "192.168.1.5:502".into(),
347
+ results: vec![RegisterRangeResult {
348
+ register_type: "holding".into(),
349
+ start_address: 0,
350
+ count: 4,
351
+ values: vec![100, 200, 300, 400],
352
+ raw_bytes: vec!["0x0064".into(), "0x00C8".into()],
353
+ }],
354
+ total_registers: 4,
355
+ };
356
+ let v = serde_json::to_value(&r).unwrap();
357
+ assert_eq!(v["station"], 1);
358
+ assert_eq!(v["results"][0]["values"][1], 200);
359
+ assert_eq!(v["total_registers"], 4);
360
+ let back: ModbusReadResult = serde_json::from_value(v).unwrap();
361
+ assert_eq!(back.results[0].values.len(), 4);
362
+ }
363
+
364
+ #[test]
365
+ fn modbus_write_result_round_trip() {
366
+ let r = ModbusWriteResult {
367
+ station: 1,
368
+ transport: "tcp".into(),
369
+ endpoint: "192.168.1.5:502".into(),
370
+ writes: vec![WriteRangeResult {
371
+ register_type: "holding".into(),
372
+ start_address: 0,
373
+ count: 2,
374
+ confirmed: true,
375
+ }],
376
+ total_written: 2,
377
+ all_confirmed: true,
378
+ };
379
+ let v = serde_json::to_value(&r).unwrap();
380
+ assert_eq!(v["all_confirmed"], true);
381
+ let back: ModbusWriteResult = serde_json::from_value(v).unwrap();
382
+ assert!(back.all_confirmed);
383
+ }
384
+
385
+ #[test]
386
+ fn signal_normalize_result_with_stats() {
387
+ let r = SignalNormalizeResult {
388
+ method: "min-max".into(),
389
+ input_count: 5,
390
+ output: vec![0.0, 0.25, 0.5, 0.75, 1.0],
391
+ stats: SignalStats {
392
+ min: 0.0,
393
+ max: 100.0,
394
+ mean: 50.0,
395
+ std_dev: 31.62,
396
+ },
397
+ };
398
+ let v = serde_json::to_value(&r).unwrap();
399
+ assert_eq!(v["stats"]["mean"], 50.0);
400
+ assert_eq!(v["output"].as_array().unwrap().len(), 5);
401
+ let back: SignalNormalizeResult = serde_json::from_value(v).unwrap();
402
+ assert_eq!(back.stats.min, 0.0);
403
+ }
404
+
405
+ #[test]
406
+ fn mouse_operate_result_round_trip() {
407
+ let r = MouseOperateResult {
408
+ remote_id: "ssh-1".into(),
409
+ action: "click".into(),
410
+ x: 100,
411
+ y: 200,
412
+ button: "left".into(),
413
+ success: true,
414
+ };
415
+ let v = serde_json::to_value(&r).unwrap();
416
+ assert_eq!(v["x"], 100);
417
+ assert_eq!(v["button"], "left");
418
+ }
419
+
420
+ #[test]
421
+ fn modbus_scan_config_optional_function_code() {
422
+ let c = ModbusScanConfig {
423
+ address: 0,
424
+ count: 10,
425
+ function_code: None,
426
+ };
427
+ let v = serde_json::to_value(&c).unwrap();
428
+ // function_code uses skip_serializing_if.
429
+ assert!(v.get("function_code").is_none());
430
+ }
431
+
432
+ #[test]
433
+ fn modbus_scan_config_with_function_code() {
434
+ let c = ModbusScanConfig {
435
+ address: 0,
436
+ count: 10,
437
+ function_code: Some(3),
438
+ };
439
+ let v = serde_json::to_value(&c).unwrap();
440
+ assert_eq!(v["function_code"], 3);
441
+ }
442
+ }