@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,377 @@
1
+ use uuid::Uuid;
2
+
3
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
4
+ #[ts(export, export_to = "mcp/hubris.ts")]
5
+ pub struct ReportResult {
6
+ pub summary: String,
7
+ }
8
+
9
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
10
+ #[ts(export, export_to = "mcp/hubris.ts")]
11
+ pub struct TodoTreeNode {
12
+ pub id: Uuid,
13
+ pub title: String,
14
+ pub status: String,
15
+ pub children: Vec<TodoTreeNode>,
16
+ pub depth: usize,
17
+ pub description: Option<String>,
18
+ pub priority: Option<String>,
19
+ pub tags: Vec<String>,
20
+ }
21
+
22
+ // ── Tool parameter structs (for .d.ts API signature generation) ──
23
+
24
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
25
+ #[ts(export, export_to = "mcp/hubris.ts")]
26
+ pub struct CreateTodoParams {
27
+ pub title: String,
28
+ pub workspace_id: Option<String>,
29
+ pub user_id: Option<String>,
30
+ pub parent_id: Option<Uuid>,
31
+ pub description: Option<String>,
32
+ pub metadata: Option<std::collections::HashMap<String, String>>,
33
+ pub claimed_by: Option<String>,
34
+ }
35
+
36
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
37
+ #[ts(export, export_to = "mcp/hubris.ts")]
38
+ pub struct ListTodoParams {
39
+ pub workspace_id: Option<String>,
40
+ pub parent_id: Option<Uuid>,
41
+ pub status: Option<String>,
42
+ pub tree: Option<bool>,
43
+ #[serde(default)]
44
+ pub view: Option<String>,
45
+ }
46
+
47
+ impl ListTodoParams {
48
+ pub fn normalize(&mut self) {
49
+ if self.tree.is_none()
50
+ && let Some(ref v) = self.view
51
+ {
52
+ match v.as_str() {
53
+ "tree" | "true" => self.tree = Some(true),
54
+ _ => self.tree = Some(false),
55
+ }
56
+ }
57
+ }
58
+ }
59
+
60
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
61
+ #[ts(export, export_to = "mcp/hubris.ts")]
62
+ pub struct UpdateTodoParams {
63
+ pub todo_id: Uuid,
64
+ pub title: Option<String>,
65
+ pub description: Option<String>,
66
+ pub status: Option<String>,
67
+ pub claimed_by: Option<String>,
68
+ pub parent_id: Option<Uuid>,
69
+ pub metadata: Option<std::collections::HashMap<String, String>>,
70
+ }
71
+
72
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
73
+ #[ts(export, export_to = "mcp/hubris.ts")]
74
+ pub struct DeleteTodoParams {
75
+ pub todo_id: Uuid,
76
+ pub workspace_id: Option<String>,
77
+ }
78
+
79
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
80
+ #[ts(export, export_to = "mcp/hubris.ts")]
81
+ pub struct ClearTodoParams {
82
+ pub workspace_id: Option<String>,
83
+ pub dry_run: Option<bool>,
84
+ pub status: Option<String>,
85
+ }
86
+
87
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
88
+ #[ts(export, export_to = "mcp/hubris.ts")]
89
+ pub struct MoveTodoParams {
90
+ pub todo_id: Uuid,
91
+ pub new_parent_id: Option<Uuid>,
92
+ pub sort_order: Option<i32>,
93
+ }
94
+
95
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
96
+ #[ts(export, export_to = "mcp/hubris.ts")]
97
+ pub struct ReportParams {
98
+ pub text: Option<String>,
99
+ pub summary: Option<String>,
100
+ pub body: Option<String>,
101
+ pub content: Option<String>,
102
+ }
103
+
104
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
105
+ #[ts(export, export_to = "mcp/hubris.ts")]
106
+ pub struct ReportHumanParams {
107
+ pub summary: String,
108
+ pub body: Option<String>,
109
+ pub text: Option<String>,
110
+ pub mode: Option<String>,
111
+ pub content: Option<String>,
112
+ }
113
+
114
+ // ── Tool result structs ──
115
+
116
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
117
+ #[ts(export, export_to = "mcp/hubris.ts")]
118
+ pub struct TodoCreateResult {
119
+ pub id: Uuid,
120
+ pub title: String,
121
+ pub status: String,
122
+ pub parent_id: Option<Uuid>,
123
+ pub created_at: String,
124
+ }
125
+
126
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
127
+ #[ts(export, export_to = "mcp/hubris.ts")]
128
+ pub struct TodoListItem {
129
+ pub id: Uuid,
130
+ pub title: String,
131
+ pub status: String,
132
+ pub parent_id: Option<Uuid>,
133
+ pub claimed_by: String,
134
+ pub created_at: String,
135
+ pub updated_at: String,
136
+ pub description: Option<String>,
137
+ pub tags: Vec<String>,
138
+ }
139
+
140
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
141
+ #[ts(export, export_to = "mcp/hubris.ts")]
142
+ pub struct TodoListResult {
143
+ pub total: usize,
144
+ pub items: Vec<TodoListItem>,
145
+ }
146
+
147
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
148
+ #[ts(export, export_to = "mcp/hubris.ts")]
149
+ pub struct TodoTreeListResult {
150
+ pub total: usize,
151
+ pub tree: Vec<TodoTreeNode>,
152
+ }
153
+
154
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
155
+ #[ts(export, export_to = "mcp/hubris.ts")]
156
+ pub struct TodoUpdateResult {
157
+ pub id: Uuid,
158
+ pub title: String,
159
+ pub status: String,
160
+ pub updated_at: String,
161
+ }
162
+
163
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
164
+ #[ts(export, export_to = "mcp/hubris.ts")]
165
+ pub struct TodoDeleteResult {
166
+ pub deleted_id: Uuid,
167
+ pub success: bool,
168
+ }
169
+
170
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
171
+ #[ts(export, export_to = "mcp/hubris.ts")]
172
+ pub struct TodoClearItem {
173
+ pub id: Uuid,
174
+ pub title: String,
175
+ pub status: String,
176
+ }
177
+
178
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
179
+ #[ts(export, export_to = "mcp/hubris.ts")]
180
+ pub struct TodoClearDryRunResult {
181
+ pub dry_run: bool,
182
+ pub would_delete: usize,
183
+ pub items: Vec<TodoClearItem>,
184
+ }
185
+
186
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
187
+ #[ts(export, export_to = "mcp/hubris.ts")]
188
+ pub struct TodoClearResult {
189
+ pub deleted_count: u64,
190
+ pub success: bool,
191
+ }
192
+
193
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
194
+ #[ts(export, export_to = "mcp/hubris.ts")]
195
+ pub struct TodoMoveResult {
196
+ pub id: Uuid,
197
+ pub parent_id: Option<Uuid>,
198
+ pub sort_order: i32,
199
+ pub updated_at: String,
200
+ }
201
+
202
+ #[cfg(test)]
203
+ mod tests {
204
+ use super::*;
205
+ use serde_json::json;
206
+
207
+ #[test]
208
+ fn report_result_round_trip() {
209
+ let r = ReportResult {
210
+ summary: "task done".into(),
211
+ };
212
+ let v = serde_json::to_value(&r).unwrap();
213
+ assert_eq!(v, json!({"summary": "task done"}));
214
+ let back: ReportResult = serde_json::from_value(v).unwrap();
215
+ assert_eq!(back.summary, "task done");
216
+ }
217
+
218
+ #[test]
219
+ fn todo_tree_node_nested_round_trip() {
220
+ let child = TodoTreeNode {
221
+ id: Uuid::new_v4(),
222
+ title: "child".into(),
223
+ status: "pending".into(),
224
+ children: vec![],
225
+ depth: 1,
226
+ description: Some("a child".into()),
227
+ priority: Some("high".into()),
228
+ tags: vec!["bug".into()],
229
+ };
230
+ let parent = TodoTreeNode {
231
+ id: Uuid::new_v4(),
232
+ title: "parent".into(),
233
+ status: "in_progress".into(),
234
+ children: vec![child.clone()],
235
+ depth: 0,
236
+ description: None,
237
+ priority: None,
238
+ tags: vec![],
239
+ };
240
+ let v = serde_json::to_value(&parent).unwrap();
241
+ assert_eq!(v["children"].as_array().unwrap().len(), 1);
242
+ assert_eq!(v["children"][0]["title"], "child");
243
+ let back: TodoTreeNode = serde_json::from_value(v).unwrap();
244
+ assert_eq!(back.children.len(), 1);
245
+ assert_eq!(back.children[0].id, child.id);
246
+ }
247
+
248
+ #[test]
249
+ fn create_todo_params_optional_fields() {
250
+ let p = CreateTodoParams {
251
+ title: "new task".into(),
252
+ workspace_id: None,
253
+ user_id: None,
254
+ parent_id: None,
255
+ description: None,
256
+ metadata: None,
257
+ claimed_by: None,
258
+ };
259
+ let v = serde_json::to_value(&p).unwrap();
260
+ assert_eq!(v["title"], "new task");
261
+ assert!(
262
+ v.get("description").is_some(),
263
+ "Option fields present as null"
264
+ );
265
+ }
266
+
267
+ #[test]
268
+ fn list_todo_params_normalize_view_tree() {
269
+ let mut p = ListTodoParams {
270
+ workspace_id: None,
271
+ parent_id: None,
272
+ status: None,
273
+ tree: None,
274
+ view: Some("tree".into()),
275
+ };
276
+ p.normalize();
277
+ assert_eq!(p.tree, Some(true));
278
+ }
279
+
280
+ #[test]
281
+ fn list_todo_params_normalize_view_true() {
282
+ let mut p = ListTodoParams {
283
+ workspace_id: None,
284
+ parent_id: None,
285
+ status: None,
286
+ tree: None,
287
+ view: Some("true".into()),
288
+ };
289
+ p.normalize();
290
+ assert_eq!(p.tree, Some(true));
291
+ }
292
+
293
+ #[test]
294
+ fn list_todo_params_normalize_view_other() {
295
+ let mut p = ListTodoParams {
296
+ workspace_id: None,
297
+ parent_id: None,
298
+ status: None,
299
+ tree: None,
300
+ view: Some("list".into()),
301
+ };
302
+ p.normalize();
303
+ assert_eq!(p.tree, Some(false));
304
+ }
305
+
306
+ #[test]
307
+ fn list_todo_params_normalize_no_view() {
308
+ let mut p = ListTodoParams {
309
+ workspace_id: None,
310
+ parent_id: None,
311
+ status: None,
312
+ tree: None,
313
+ view: None,
314
+ };
315
+ p.normalize();
316
+ assert_eq!(p.tree, None);
317
+ }
318
+
319
+ #[test]
320
+ fn list_todo_params_normalize_preserves_existing_tree() {
321
+ let mut p = ListTodoParams {
322
+ workspace_id: None,
323
+ parent_id: None,
324
+ status: None,
325
+ tree: Some(false),
326
+ view: Some("tree".into()),
327
+ };
328
+ p.normalize();
329
+ // Existing tree value takes precedence.
330
+ assert_eq!(p.tree, Some(false));
331
+ }
332
+
333
+ #[test]
334
+ fn todo_clear_dry_run_result_round_trip() {
335
+ let r = TodoClearDryRunResult {
336
+ dry_run: true,
337
+ would_delete: 3,
338
+ items: vec![TodoClearItem {
339
+ id: Uuid::new_v4(),
340
+ title: "t".into(),
341
+ status: "done".into(),
342
+ }],
343
+ };
344
+ let v = serde_json::to_value(&r).unwrap();
345
+ assert_eq!(v["dry_run"], true);
346
+ assert_eq!(v["would_delete"], 3);
347
+ assert_eq!(v["items"].as_array().unwrap().len(), 1);
348
+ let back: TodoClearDryRunResult = serde_json::from_value(v).unwrap();
349
+ assert!(back.dry_run);
350
+ assert_eq!(back.would_delete, 3);
351
+ }
352
+
353
+ #[test]
354
+ fn todo_delete_result_round_trip() {
355
+ let id = Uuid::new_v4();
356
+ let r = TodoDeleteResult {
357
+ deleted_id: id,
358
+ success: true,
359
+ };
360
+ let v = serde_json::to_value(&r).unwrap();
361
+ assert_eq!(v["deleted_id"], id.to_string());
362
+ assert_eq!(v["success"], true);
363
+ }
364
+
365
+ #[test]
366
+ fn report_params_all_optional() {
367
+ let p = ReportParams {
368
+ text: None,
369
+ summary: None,
370
+ body: None,
371
+ content: None,
372
+ };
373
+ let v = serde_json::to_value(&p).unwrap();
374
+ // All fields present as null (no skip_serializing_if).
375
+ assert_eq!(v.as_object().unwrap().len(), 4);
376
+ }
377
+ }
@@ -0,0 +1,251 @@
1
+ use super::haplotes::{AgentReference, ConflictInfo};
2
+ use crate::enums::{AnnotationType, FileOpStatus, FileType};
3
+
4
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
5
+ #[ts(export, export_to = "mcp/kalos.ts")]
6
+ pub struct FileListResult {
7
+ pub path: String,
8
+ pub total_count: usize,
9
+ #[serde(rename = "items")]
10
+ pub entries: Vec<FileEntry>,
11
+ }
12
+
13
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
14
+ #[ts(export, export_to = "mcp/kalos.ts")]
15
+ pub struct FileEntry {
16
+ pub name: String,
17
+ #[serde(rename = "type")]
18
+ pub file_type: FileType,
19
+ }
20
+
21
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
22
+ #[ts(export, export_to = "mcp/kalos.ts")]
23
+ pub struct MkDirResult {
24
+ pub path: String,
25
+ pub status: FileOpStatus,
26
+ }
27
+
28
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
29
+ #[ts(export, export_to = "mcp/kalos.ts")]
30
+ pub struct FileDeleteResult {
31
+ pub path: String,
32
+ pub status: FileOpStatus,
33
+ #[serde(default)]
34
+ pub conflicts: Vec<ConflictInfo>,
35
+ }
36
+
37
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
38
+ #[ts(export, export_to = "mcp/kalos.ts")]
39
+ pub struct FileEditResult {
40
+ pub path: String,
41
+ pub status: FileOpStatus,
42
+ pub occurrences: usize,
43
+ #[serde(default)]
44
+ pub conflicts: Vec<ConflictInfo>,
45
+ }
46
+
47
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
48
+ #[ts(export, export_to = "mcp/kalos.ts")]
49
+ pub struct FileReadResult {
50
+ pub path: String,
51
+ pub size_bytes: usize,
52
+ pub content: String,
53
+ #[serde(default)]
54
+ pub conflicts: Vec<ConflictInfo>,
55
+ }
56
+
57
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
58
+ #[ts(export, export_to = "mcp/kalos.ts")]
59
+ pub struct FileExistsResult {
60
+ pub path: String,
61
+ pub exists: bool,
62
+ }
63
+
64
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
65
+ #[ts(export, export_to = "mcp/kalos.ts")]
66
+ pub struct FileWriteResult {
67
+ pub path: String,
68
+ pub size_bytes: usize,
69
+ pub status: FileOpStatus,
70
+ #[serde(default)]
71
+ pub conflicts: Vec<ConflictInfo>,
72
+ }
73
+
74
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
75
+ #[ts(export, export_to = "mcp/kalos.ts")]
76
+ pub struct FileInfoResult {
77
+ pub path: String,
78
+ #[serde(rename = "type")]
79
+ pub file_type: FileType,
80
+ pub size_bytes: u64,
81
+ pub modified_unix: u64,
82
+ }
83
+
84
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
85
+ #[ts(export, export_to = "mcp/kalos.ts")]
86
+ pub struct FileTreeEntry {
87
+ pub name: String,
88
+ pub path: String,
89
+ pub is_dir: bool,
90
+ pub children: Vec<FileTreeEntry>,
91
+ pub size: Option<u64>,
92
+ }
93
+
94
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
95
+ #[ts(export, export_to = "mcp/kalos.ts")]
96
+ pub struct FileTreeListResult {
97
+ pub path: String,
98
+ pub total_count: usize,
99
+ pub tree: Vec<FileTreeEntry>,
100
+ }
101
+
102
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
103
+ #[ts(export, export_to = "mcp/kalos.ts")]
104
+ pub struct Annotation {
105
+ pub id: String,
106
+ pub file_path: String,
107
+ pub line_start: Option<u32>,
108
+ pub line_end: Option<u32>,
109
+ pub content: String,
110
+ pub annotation_type: AnnotationType,
111
+ pub author: Option<AgentReference>,
112
+ pub created_at: String,
113
+ pub resolved: bool,
114
+ pub resolved_at: Option<String>,
115
+ }
116
+
117
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
118
+ #[ts(export, export_to = "mcp/kalos.ts")]
119
+ pub struct ListAnnotationsResult {
120
+ pub file_path: String,
121
+ pub annotations: Vec<Annotation>,
122
+ }
123
+
124
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
125
+ #[ts(export, export_to = "mcp/kalos.ts")]
126
+ pub struct ResolveAnnotationResult {
127
+ pub annotation_id: String,
128
+ pub resolved: bool,
129
+ }
130
+
131
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
132
+ #[ts(export, export_to = "mcp/kalos.ts")]
133
+ pub struct FileReadParams {
134
+ pub path: String,
135
+ }
136
+
137
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
138
+ #[ts(export, export_to = "mcp/kalos.ts")]
139
+ pub struct FileWriteParams {
140
+ pub path: String,
141
+ pub content: String,
142
+ }
143
+
144
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
145
+ #[ts(export, export_to = "mcp/kalos.ts")]
146
+ pub struct FileEditParams {
147
+ pub path: String,
148
+ pub old_content: String,
149
+ pub new_content: String,
150
+ }
151
+
152
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
153
+ #[ts(export, export_to = "mcp/kalos.ts")]
154
+ pub struct FileDeleteParams {
155
+ pub path: String,
156
+ }
157
+
158
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
159
+ #[ts(export, export_to = "mcp/kalos.ts")]
160
+ pub struct FileExistsParams {
161
+ pub path: String,
162
+ }
163
+
164
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
165
+ #[ts(export, export_to = "mcp/kalos.ts")]
166
+ pub struct FileListParams {
167
+ pub path: String,
168
+ #[serde(default)]
169
+ pub recursive: Option<bool>,
170
+ }
171
+
172
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
173
+ #[ts(export, export_to = "mcp/kalos.ts")]
174
+ pub struct FileGetInfoParams {
175
+ pub path: String,
176
+ }
177
+
178
+ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
179
+ #[ts(export, export_to = "mcp/kalos.ts")]
180
+ pub struct FileCreateDirParams {
181
+ pub path: String,
182
+ }
183
+
184
+ #[cfg(test)]
185
+ mod tests {
186
+ use super::*;
187
+ use crate::enums::FileOperationType;
188
+ use anyhow::Result;
189
+
190
+ #[test]
191
+ fn test_file_read_result_with_conflicts() -> Result<()> {
192
+ let r = FileReadResult {
193
+ path: "src/main.rs".to_string(),
194
+ size_bytes: 100,
195
+ content: "fn main() {}".to_string(),
196
+ conflicts: vec![ConflictInfo {
197
+ conflict_id: "cflict-001".to_string(),
198
+ file_path: "src/main.rs".to_string(),
199
+ line_range: None,
200
+ conflicting_agent: super::super::haplotes::AgentReference {
201
+ agent_type: "WebAutomation".to_string(),
202
+ instance_badge: None,
203
+ },
204
+ operation_type: FileOperationType::Editing,
205
+ since: "2026-05-11T10:00:00Z".to_string(),
206
+ }],
207
+ };
208
+ let json = serde_json::to_string(&r)?;
209
+ let de: FileReadResult = serde_json::from_str(&json)?;
210
+ assert_eq!(de.conflicts.len(), 1);
211
+ assert_eq!(de.conflicts[0].conflict_id, "cflict-001");
212
+ Ok(())
213
+ }
214
+
215
+ #[test]
216
+ fn test_file_edit_result_with_empty_conflicts() -> Result<()> {
217
+ let r = FileEditResult {
218
+ path: "src/lib.rs".to_string(),
219
+ status: FileOpStatus::Edited,
220
+ occurrences: 1,
221
+ conflicts: vec![],
222
+ };
223
+ let json = serde_json::to_string(&r)?;
224
+ assert!(json.contains("conflicts"));
225
+ let de: FileEditResult = serde_json::from_str(&json)?;
226
+ assert!(de.conflicts.is_empty());
227
+ Ok(())
228
+ }
229
+
230
+ #[test]
231
+ fn test_backward_compat_missing_conflicts() -> Result<()> {
232
+ let mut map = serde_json::Map::new();
233
+ map.insert(
234
+ "path".to_string(),
235
+ serde_json::Value::String("src/lib.rs".to_string()),
236
+ );
237
+ map.insert(
238
+ "status".to_string(),
239
+ serde_json::Value::String("Edited".to_string()),
240
+ );
241
+ map.insert(
242
+ "occurrences".to_string(),
243
+ serde_json::Value::Number(1.into()),
244
+ );
245
+ let val = serde_json::Value::Object(map);
246
+ let json = serde_json::to_string(&val)?;
247
+ let de: FileEditResult = serde_json::from_str(&json)?;
248
+ assert!(de.conflicts.is_empty());
249
+ Ok(())
250
+ }
251
+ }
package/src/mcp/mod.rs ADDED
@@ -0,0 +1,23 @@
1
+ //! MCP tool type definitions.
2
+ //!
3
+ //! Per-agent MCP tool result/request types. These are the structured data
4
+ //! contracts for every tool exposed by the multi-agent platform's exec-only
5
+ //! microkernel architecture. Both entelecheia (Rust) and shittim-chest (TS)
6
+ //! consume these types via ts-rs code generation.
7
+ //!
8
+ //! Only per-agent tool I/O structs live here. Shared domain vocabulary enums
9
+ //! live at [`crate::enums`] and external server config at [`crate::external_mcp`].
10
+
11
+ pub mod aporia;
12
+ pub mod eleos;
13
+ pub mod epieikeia;
14
+ pub mod haplotes;
15
+ pub mod hubris;
16
+ pub mod kalos;
17
+ pub mod neikos;
18
+ pub mod orexis;
19
+ pub mod philia;
20
+ pub mod polemos;
21
+ pub mod skemma;
22
+ pub mod skopeo;
23
+ pub mod web_automation;