@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,371 @@
1
+ //! LLM provider configuration & config-filesystem types.
2
+ //!
3
+ //! Covers provider lifecycle events, configured-provider catalog, usage
4
+ //! periods, the on-disk provider/model filesystem schema, user config, and
5
+ //! API-key registry info.
6
+
7
+ use serde::{Deserialize, Serialize};
8
+ use ts_rs::TS;
9
+
10
+ use crate::PeriodType;
11
+
12
+ // ═══════════════════════════════════════════════════════════════
13
+ // LLM Provider configuration
14
+ // ═══════════════════════════════════════════════════════════════
15
+
16
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
17
+ #[ts(export, export_to = "ws/llmProvider.ts")]
18
+ pub struct LlmProviderConfiguredParams {
19
+ pub provider_name: String,
20
+ pub success: bool,
21
+ #[serde(default)]
22
+ #[ts(optional)]
23
+ pub error: Option<String>,
24
+ }
25
+
26
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
27
+ #[ts(export, export_to = "ws/llmProvider.ts")]
28
+ pub struct ProviderRenamedParams {
29
+ pub provider_name: String,
30
+ pub new_display_name: String,
31
+ pub success: bool,
32
+ #[serde(default)]
33
+ #[ts(optional)]
34
+ pub error: Option<String>,
35
+ }
36
+
37
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
38
+ #[ts(export, export_to = "ws/llmProvider.ts")]
39
+ pub struct ProviderEditedParams {
40
+ pub provider_name: String,
41
+ pub success: bool,
42
+ #[serde(default)]
43
+ #[ts(optional)]
44
+ pub error: Option<String>,
45
+ }
46
+
47
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
48
+ #[ts(export, export_to = "ws/llmProvider.ts")]
49
+ pub struct ProviderDeletedParams {
50
+ pub provider_name: String,
51
+ pub success: bool,
52
+ #[serde(default)]
53
+ #[ts(optional)]
54
+ pub error: Option<String>,
55
+ }
56
+
57
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
58
+ #[ts(export, export_to = "ws/llmProvider.ts")]
59
+ pub struct ConfiguredProviderInfo {
60
+ pub provider_name: String,
61
+ pub display_name: String,
62
+ #[serde(default)]
63
+ #[ts(optional)]
64
+ pub api_endpoint: Option<String>,
65
+ pub default_model: String,
66
+ pub is_enabled: bool,
67
+ }
68
+
69
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
70
+ #[ts(export, export_to = "ws/llmProvider.ts")]
71
+ pub struct ConfiguredProvidersListParams {
72
+ pub providers: Vec<ConfiguredProviderInfo>,
73
+ }
74
+
75
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
76
+ #[ts(export, export_to = "ws/llmProvider.ts")]
77
+ pub struct ModelProviderConfigUpdatedParams {
78
+ pub provider_name: String,
79
+ pub success: bool,
80
+ #[serde(default)]
81
+ #[ts(optional)]
82
+ pub error: Option<String>,
83
+ }
84
+
85
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
86
+ #[ts(export, export_to = "ws/llmProvider.ts")]
87
+ pub struct EndpointValidatedParams {
88
+ pub provider_name: String,
89
+ pub is_reachable: bool,
90
+ #[serde(default)]
91
+ #[ts(optional)]
92
+ pub latency_ms: Option<u64>,
93
+ #[serde(default)]
94
+ #[ts(optional)]
95
+ pub error: Option<String>,
96
+ }
97
+
98
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
99
+ #[ts(export, export_to = "ws/llmProvider.ts")]
100
+ pub struct UsagePeriodData {
101
+ pub user_id: String,
102
+ pub period_type: PeriodType,
103
+ pub used_tokens: u64,
104
+ pub cost: f64,
105
+ pub start_time: String,
106
+ #[serde(default)]
107
+ #[ts(optional)]
108
+ pub remaining_tokens: Option<u64>,
109
+ #[serde(default)]
110
+ #[ts(optional)]
111
+ pub remaining_cost: Option<f64>,
112
+ }
113
+
114
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
115
+ #[ts(export, export_to = "ws/llmProvider.ts")]
116
+ pub struct UsagePeriodResponseParams {
117
+ pub data: Vec<UsagePeriodData>,
118
+ }
119
+
120
+ // ═══════════════════════════════════════════════════════════════
121
+ // Config Filesystem
122
+ // ═══════════════════════════════════════════════════════════════
123
+
124
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
125
+ #[ts(export, export_to = "ws/llmProvider.ts")]
126
+ pub struct EntrypointApiConfigInfo {
127
+ pub protocol: String,
128
+ pub base_url: String,
129
+ pub chat_endpoint: String,
130
+ #[serde(default)]
131
+ #[ts(optional)]
132
+ pub models_endpoint: Option<String>,
133
+ pub auth_type: String,
134
+ #[serde(default)]
135
+ #[ts(optional)]
136
+ pub auth_header: Option<String>,
137
+ pub env_var: String,
138
+ }
139
+
140
+ #[derive(Debug, Clone, Serialize, Deserialize, Default, TS)]
141
+ #[ts(export, export_to = "ws/llmProvider.ts")]
142
+ pub struct MaxConcurrentInfo {
143
+ #[serde(default)]
144
+ pub deep: usize,
145
+ #[serde(default)]
146
+ pub normal: usize,
147
+ #[serde(default)]
148
+ pub basic: usize,
149
+ }
150
+
151
+ #[derive(Debug, Clone, Serialize, Deserialize, Default, TS)]
152
+ #[ts(export, export_to = "ws/llmProvider.ts")]
153
+ pub struct EntrypointDefaultsInfo {
154
+ #[serde(default)]
155
+ pub deep: Vec<String>,
156
+ #[serde(default)]
157
+ pub normal: Vec<String>,
158
+ #[serde(default)]
159
+ pub basic: Vec<String>,
160
+ #[serde(default)]
161
+ pub max_concurrent: MaxConcurrentInfo,
162
+ }
163
+
164
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
165
+ #[ts(export, export_to = "ws/llmProvider.ts")]
166
+ pub struct QuotaInfo {
167
+ pub data_limit: u64,
168
+ #[serde(default)]
169
+ #[ts(optional)]
170
+ pub period_hours: Option<u32>,
171
+ #[serde(default)]
172
+ #[ts(optional)]
173
+ pub period_days: Option<u32>,
174
+ #[serde(default)]
175
+ pub billing_metric: String,
176
+ }
177
+
178
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
179
+ #[ts(export, export_to = "ws/llmProvider.ts")]
180
+ pub struct EntrypointConfigInfo {
181
+ pub id: String,
182
+ #[serde(default)]
183
+ pub name: std::collections::HashMap<String, String>,
184
+ #[serde(default, rename = "type")]
185
+ #[ts(rename = "type")]
186
+ pub entry_type: String,
187
+ #[serde(default)]
188
+ pub billing_type: String,
189
+ #[serde(default)]
190
+ pub plan_tier: String,
191
+ pub api: EntrypointApiConfigInfo,
192
+ #[serde(default)]
193
+ pub defaults: EntrypointDefaultsInfo,
194
+ #[serde(default)]
195
+ pub quotas: Vec<QuotaInfo>,
196
+ #[serde(default)]
197
+ pub models: Vec<String>,
198
+ }
199
+
200
+ #[derive(Debug, Clone, Serialize, Deserialize, Default, TS)]
201
+ #[ts(export, export_to = "ws/llmProvider.ts")]
202
+ pub struct ProviderCapabilitiesInfo {
203
+ #[serde(default)]
204
+ pub streaming: bool,
205
+ #[serde(default)]
206
+ pub function_calling: bool,
207
+ #[serde(default)]
208
+ pub vision: bool,
209
+ #[serde(default)]
210
+ pub reasoning: bool,
211
+ }
212
+
213
+ #[derive(Debug, Clone, Serialize, Deserialize, Default, TS)]
214
+ #[ts(export, export_to = "ws/llmProvider.ts")]
215
+ pub struct ProviderLimitsInfo {
216
+ #[serde(default)]
217
+ pub max_concurrent: u32,
218
+ #[serde(default)]
219
+ #[ts(optional)]
220
+ pub rate_limit_per_minute: Option<u32>,
221
+ #[serde(default)]
222
+ pub timeout_seconds: u64,
223
+ }
224
+
225
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
226
+ #[ts(export, export_to = "ws/llmProvider.ts")]
227
+ pub struct ProviderFsInfoParams {
228
+ pub providers: Vec<ProviderFsInfo>,
229
+ }
230
+
231
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
232
+ #[ts(export, export_to = "ws/llmProvider.ts")]
233
+ pub struct ModelFsPricing {
234
+ #[serde(default)]
235
+ #[ts(optional)]
236
+ pub input_per_million: Option<f64>,
237
+ #[serde(default)]
238
+ #[ts(optional)]
239
+ pub output_per_million: Option<f64>,
240
+ #[serde(default)]
241
+ #[ts(optional)]
242
+ pub cached_per_million: Option<f64>,
243
+ }
244
+
245
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
246
+ #[ts(export, export_to = "ws/llmProvider.ts")]
247
+ pub struct RateRuleInfo {
248
+ pub timezone_offset: i32,
249
+ pub peak_start: u32,
250
+ pub peak_end: u32,
251
+ pub peak_multiplier: f64,
252
+ pub off_peak_multiplier: f64,
253
+ }
254
+
255
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
256
+ #[ts(export, export_to = "ws/llmProvider.ts")]
257
+ pub struct ModelFsInfo {
258
+ pub id: String,
259
+ pub name: String,
260
+ pub provider_id: String,
261
+ pub context_window: u64,
262
+ pub max_output_tokens: u64,
263
+ #[serde(default)]
264
+ pub supports_vision: bool,
265
+ #[serde(default = "crate::default_true")]
266
+ pub supports_function_calling: bool,
267
+ #[serde(default = "crate::default_true")]
268
+ pub supports_streaming: bool,
269
+ #[serde(default)]
270
+ pub supports_reasoning: bool,
271
+ #[serde(default)]
272
+ pub tags: Vec<String>,
273
+ /// Fine-grained capability flags. When non-empty, supersedes the boolean
274
+ /// flags above for skill→model routing. See [`crate::ModelCapability`].
275
+ #[serde(default)]
276
+ pub capabilities: Vec<crate::ModelCapability>,
277
+ /// Generation quality tier (image / 3D generation models only).
278
+ /// See [`crate::GenerationTier`].
279
+ #[serde(default)]
280
+ #[ts(optional)]
281
+ pub generation_tier: Option<crate::GenerationTier>,
282
+ /// Hardware requirements (local generative models only).
283
+ /// See [`crate::HardwareRequirements`].
284
+ #[serde(default)]
285
+ #[ts(optional)]
286
+ pub hardware_requirements: Option<crate::HardwareRequirements>,
287
+ #[serde(default)]
288
+ #[ts(optional)]
289
+ pub pricing: Option<ModelFsPricing>,
290
+ #[serde(default)]
291
+ #[ts(optional)]
292
+ pub rate_multiplier: Option<f64>,
293
+ #[serde(default)]
294
+ pub rate_rules: Vec<RateRuleInfo>,
295
+ }
296
+
297
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
298
+ #[ts(export, export_to = "ws/llmProvider.ts")]
299
+ pub struct ModelFsInfoParams {
300
+ pub models: Vec<ModelFsInfo>,
301
+ }
302
+
303
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
304
+ #[ts(export, export_to = "ws/llmProvider.ts")]
305
+ pub struct ProviderFsInfo {
306
+ pub id: String,
307
+ #[serde(default)]
308
+ pub name: std::collections::HashMap<String, String>,
309
+ #[serde(default)]
310
+ pub protocol: String,
311
+ #[serde(default)]
312
+ pub category: String,
313
+ #[serde(default)]
314
+ #[ts(optional)]
315
+ pub base_url: Option<String>,
316
+ #[serde(default)]
317
+ pub entry_points: Vec<EntrypointConfigInfo>,
318
+ #[serde(default)]
319
+ pub models: Vec<ModelFsInfo>,
320
+ #[serde(default)]
321
+ pub capabilities: ProviderCapabilitiesInfo,
322
+ #[serde(default)]
323
+ pub limits: ProviderLimitsInfo,
324
+ #[serde(default)]
325
+ pub pricing_model: String,
326
+ }
327
+
328
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
329
+ #[ts(export, export_to = "ws/llmProvider.ts")]
330
+ pub struct UserConfigResponseParams {
331
+ pub config: UserInfoConfig,
332
+ }
333
+
334
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
335
+ #[ts(export, export_to = "ws/llmProvider.ts")]
336
+ pub struct UserInfoConfig {
337
+ pub preferred_language: String,
338
+ #[serde(default)]
339
+ pub default_models: std::collections::HashMap<String, String>,
340
+ #[serde(default)]
341
+ pub enabled_providers: Vec<String>,
342
+ #[serde(default)]
343
+ pub enabled_models: Vec<String>,
344
+ #[serde(default)]
345
+ pub model_priorities: std::collections::HashMap<String, u32>,
346
+ #[serde(default)]
347
+ pub auto_import_from_env: Vec<String>,
348
+ }
349
+
350
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
351
+ #[ts(export, export_to = "ws/llmProvider.ts")]
352
+ pub struct KeysListResponseParams {
353
+ pub keys: Vec<KeyInfo>,
354
+ }
355
+
356
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
357
+ #[ts(export, export_to = "ws/llmProvider.ts")]
358
+ pub struct KeyInfo {
359
+ pub provider: String,
360
+ pub display_name: String,
361
+ pub has_key: bool,
362
+ pub created_at: String,
363
+ pub updated_at: String,
364
+ pub source: String,
365
+ }
366
+
367
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
368
+ #[ts(export, export_to = "ws/llmProvider.ts")]
369
+ pub struct ApiKeyInfoResponseParams {
370
+ pub info: KeyInfo,
371
+ }
@@ -0,0 +1,7 @@
1
+ //! Service-facing message params — authentication, LLM provider configuration,
2
+ //! knowledge-base (RAG) lifecycle, and industrial-control telemetry.
3
+
4
+ pub mod auth;
5
+ pub mod industrial;
6
+ pub mod knowledge_base;
7
+ pub mod llm_provider;
@@ -0,0 +1,96 @@
1
+ //! Bridge Network — host machines + their workspaces.
2
+ //!
3
+ //! The 3rd chat sub-page ("桥接网络"): the left column lists host machines
4
+ //! (localhost + remote polemos devices) with live performance; the right
5
+ //! column lists the workspaces attached to the selected host with their
6
+ //! noa-git status + token usage. Clicking a host opens its file browser
7
+ //! (default /home); clicking a workspace opens its on-disk directory.
8
+ //!
9
+ //! Mirrors `entelecheia/.../tui_types/message/types/mod.rs`.
10
+
11
+ use serde::{Deserialize, Serialize};
12
+ use ts_rs::TS;
13
+
14
+ /// Live performance snapshot for one host machine.
15
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
16
+ #[ts(export, export_to = "ws/bridgeNetwork.ts")]
17
+ pub struct HostMetrics {
18
+ /// Stable host id ("localhost" for self, or a polemos device id).
19
+ pub host_id: String,
20
+ pub hostname: String,
21
+ pub os: String,
22
+ /// CPU utilisation, 0..100.
23
+ pub cpu_usage_percent: f64,
24
+ /// Logical CPU core count (shown with an i18n "cores" unit).
25
+ pub cpu_cores: u32,
26
+ pub mem_used_bytes: u64,
27
+ pub mem_total_bytes: u64,
28
+ /// Outbound network rate (bytes/sec). Omitted when unknown.
29
+ #[serde(default)]
30
+ #[ts(optional)]
31
+ pub net_up_bps: Option<u64>,
32
+ /// Inbound network rate (bytes/sec). Omitted when unknown.
33
+ #[serde(default)]
34
+ #[ts(optional)]
35
+ pub net_down_bps: Option<u64>,
36
+ }
37
+
38
+ /// noa-git status for a workspace checkout (branch / dirty / ahead / behind).
39
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
40
+ #[ts(export, export_to = "ws/bridgeNetwork.ts")]
41
+ pub struct WorkspaceGitStatus {
42
+ pub branch: String,
43
+ /// Modified/untracked file count.
44
+ #[serde(default)]
45
+ pub modified: u32,
46
+ /// Commits ahead of upstream.
47
+ #[serde(default)]
48
+ pub ahead: u32,
49
+ /// Commits behind upstream.
50
+ #[serde(default)]
51
+ pub behind: u32,
52
+ /// `true` when there are uncommitted changes.
53
+ #[serde(default)]
54
+ pub dirty: bool,
55
+ }
56
+
57
+ /// One agent's token usage within a workspace (top-N entries).
58
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
59
+ #[ts(export, export_to = "ws/bridgeNetwork.ts")]
60
+ pub struct WorkspaceTokenUsage {
61
+ pub agent: String,
62
+ pub input: u64,
63
+ pub output: u64,
64
+ }
65
+
66
+ /// A workspace attached to a host, with its git + token-usage summary.
67
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
68
+ #[ts(export, export_to = "ws/bridgeNetwork.ts")]
69
+ pub struct WorkspaceNode {
70
+ #[ts(type = "string")]
71
+ pub workspace_id: uuid::Uuid,
72
+ pub host_id: String,
73
+ pub path: String,
74
+ #[serde(default)]
75
+ #[ts(optional)]
76
+ pub alias: Option<String>,
77
+ #[serde(default)]
78
+ #[ts(optional)]
79
+ pub git: Option<WorkspaceGitStatus>,
80
+ /// Top token consumers in this workspace (max 3).
81
+ #[serde(default)]
82
+ pub token_usage: Vec<WorkspaceTokenUsage>,
83
+ }
84
+
85
+ /// `Sync.RequestBridgeNetwork` — request the host/workspace roster.
86
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
87
+ #[ts(export, export_to = "ws/bridgeNetwork.ts")]
88
+ pub struct RequestBridgeNetworkParams {}
89
+
90
+ /// `Sync.BridgeNetwork` — the host/workspace roster response/push.
91
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
92
+ #[ts(export, export_to = "ws/bridgeNetwork.ts")]
93
+ pub struct BridgeNetworkParams {
94
+ pub hosts: Vec<HostMetrics>,
95
+ pub workspaces: Vec<WorkspaceNode>,
96
+ }
@@ -0,0 +1,88 @@
1
+ //! File Browsing — SyncMessage variant params.
2
+ //!
3
+ //! Browse/read files inside a container (#demiurge / #NNN), on a host machine,
4
+ //! or in a workspace checkout. Targets are distinguished by `FileTargetKind`.
5
+ //! The node-list container cards, the Bridge Network host cards and the
6
+ //! workspace cards all open this same file browser.
7
+ //!
8
+ //! Mirrors `entelecheia/.../tui_types/message/types/mod.rs`.
9
+
10
+ use serde::{Deserialize, Serialize};
11
+ use ts_rs::TS;
12
+
13
+ /// Which filesystem a file operation targets.
14
+ #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, TS)]
15
+ #[ts(export, export_to = "ws/fileBrowsing.ts")]
16
+ #[serde(rename_all = "snake_case")]
17
+ pub enum FileTargetKind {
18
+ /// A container slot — `#demiurge` or `#NNN` (id is the slot badge).
19
+ Container,
20
+ /// A host machine (id is the host_id / device id; "localhost" for self).
21
+ Host,
22
+ /// A workspace checkout (id is the workspace_id).
23
+ Workspace,
24
+ }
25
+
26
+ /// A file-operation target — a (kind, id) pair plus optional workspace
27
+ /// context (container slots are per-workspace).
28
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
29
+ #[ts(export, export_to = "ws/fileBrowsing.ts")]
30
+ pub struct FileTarget {
31
+ pub kind: FileTargetKind,
32
+ /// Container badge (`#demiurge` / `#001`), host id, or workspace id.
33
+ pub id: String,
34
+ /// Owning workspace id (container slots are workspace-scoped).
35
+ #[serde(default)]
36
+ #[ts(optional, type = "string")]
37
+ pub workspace_id: Option<uuid::Uuid>,
38
+ }
39
+
40
+ /// One entry in a directory listing.
41
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
42
+ #[ts(export, export_to = "ws/fileBrowsing.ts")]
43
+ pub struct FileTreeEntry {
44
+ pub name: String,
45
+ /// `"file"` | `"dir"` | `"symlink"`.
46
+ pub kind: String,
47
+ pub size: u64,
48
+ }
49
+
50
+ /// `Sync.RequestFileTree` — list one level of a directory.
51
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
52
+ #[ts(export, export_to = "ws/fileBrowsing.ts")]
53
+ pub struct RequestFileTreeParams {
54
+ pub target: FileTarget,
55
+ /// Sub-path under the target root (empty/`""` = root).
56
+ #[serde(default)]
57
+ pub path: String,
58
+ }
59
+
60
+ /// `Sync.FileTree` — directory listing response.
61
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
62
+ #[ts(export, export_to = "ws/fileBrowsing.ts")]
63
+ pub struct FileTreeParams {
64
+ pub target: FileTarget,
65
+ pub path: String,
66
+ pub entries: Vec<FileTreeEntry>,
67
+ }
68
+
69
+ /// `Sync.RequestFileRead` — read a single (text) file, capped server-side.
70
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
71
+ #[ts(export, export_to = "ws/fileBrowsing.ts")]
72
+ pub struct RequestFileReadParams {
73
+ pub target: FileTarget,
74
+ pub path: String,
75
+ }
76
+
77
+ /// `Sync.FileRead` — file-content response.
78
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
79
+ #[ts(export, export_to = "ws/fileBrowsing.ts")]
80
+ pub struct FileReadParams {
81
+ pub target: FileTarget,
82
+ pub path: String,
83
+ pub content: String,
84
+ pub size: u64,
85
+ /// `true` when content was truncated to the server read cap.
86
+ #[serde(default)]
87
+ pub truncated: bool,
88
+ }
@@ -0,0 +1,55 @@
1
+ //! Log entry types — server / container log streaming.
2
+
3
+ use serde::{Deserialize, Serialize};
4
+ use ts_rs::TS;
5
+
6
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
7
+ #[ts(export, export_to = "ws/logs.ts")]
8
+ pub struct LogEntryData {
9
+ pub source: String,
10
+ #[serde(default)]
11
+ #[ts(optional)]
12
+ pub instance_uuid: Option<String>,
13
+ pub level: String,
14
+ #[serde(default)]
15
+ #[ts(optional)]
16
+ pub target: Option<String>,
17
+ pub message: String,
18
+ #[serde(default)]
19
+ #[ts(type = "Record<string, unknown>")]
20
+ pub fields: serde_json::Value,
21
+ pub created_at: String,
22
+ }
23
+
24
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
25
+ #[ts(export, export_to = "ws/logs.ts")]
26
+ pub struct ServerLogEntryParams {
27
+ pub entry: LogEntryData,
28
+ }
29
+
30
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
31
+ #[ts(export, export_to = "ws/logs.ts")]
32
+ pub struct ContainerLogEntryParams {
33
+ pub instance_uuid: String,
34
+ pub entry: LogEntryData,
35
+ }
36
+
37
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
38
+ #[ts(export, export_to = "ws/logs.ts")]
39
+ pub struct SubscribeLogsResponseParams {
40
+ pub ok: bool,
41
+ #[serde(default)]
42
+ #[ts(optional)]
43
+ pub error: Option<String>,
44
+ #[serde(default)]
45
+ pub entries: Vec<LogEntryData>,
46
+ }
47
+
48
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
49
+ #[ts(export, export_to = "ws/logs.ts")]
50
+ pub struct UnsubscribeLogsResponseParams {
51
+ pub ok: bool,
52
+ #[serde(default)]
53
+ #[ts(optional)]
54
+ pub error: Option<String>,
55
+ }
@@ -0,0 +1,11 @@
1
+ //! Workspace & UI message params — workspaces & device registry, the
2
+ //! bridge-network host view, file browsing, log streaming, web-UI control,
3
+ //! dashboard views, and the NOA workspace handshake.
4
+
5
+ pub mod bridge_network;
6
+ pub mod file_browsing;
7
+ pub mod logs;
8
+ pub mod noa;
9
+ pub mod system_ui;
10
+ pub mod views;
11
+ pub mod workspace;