@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,126 @@
1
+ //! Layer-2 / custom agent registry types.
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/layer2.ts")]
8
+ pub struct Layer2AgentInfo {
9
+ pub name: String,
10
+ pub description: String,
11
+ pub mcp_count: usize,
12
+ pub skills_count: usize,
13
+ pub languages: Vec<String>,
14
+ pub enabled: bool,
15
+ }
16
+
17
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
18
+ #[ts(export, export_to = "ws/layer2.ts")]
19
+ pub struct Layer2AgentListResponseParams {
20
+ pub agents: Vec<Layer2AgentInfo>,
21
+ }
22
+
23
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
24
+ #[ts(export, export_to = "ws/layer2.ts")]
25
+ pub struct Layer2McpToolInfo {
26
+ pub name: String,
27
+ pub description: String,
28
+ pub languages: Vec<String>,
29
+ pub references_layer1: Vec<String>,
30
+ pub references_layer2: Vec<String>,
31
+ pub related_items: Vec<String>,
32
+ pub referenced_by_items: Vec<String>,
33
+ }
34
+
35
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
36
+ #[ts(export, export_to = "ws/layer2.ts")]
37
+ pub struct Layer2AgentMcpResponseParams {
38
+ pub agent_name: String,
39
+ pub tools: Vec<Layer2McpToolInfo>,
40
+ }
41
+
42
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
43
+ #[ts(export, export_to = "ws/layer2.ts")]
44
+ pub struct Layer2SkillInfo {
45
+ pub name: String,
46
+ pub description: String,
47
+ pub languages: Vec<String>,
48
+ pub references_layer1: Vec<String>,
49
+ pub references_layer2: Vec<String>,
50
+ pub related_items: Vec<String>,
51
+ pub referenced_by_items: Vec<String>,
52
+ }
53
+
54
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
55
+ #[ts(export, export_to = "ws/layer2.ts")]
56
+ pub struct Layer2AgentSkillsResponseParams {
57
+ pub agent_name: String,
58
+ pub skills: Vec<Layer2SkillInfo>,
59
+ }
60
+
61
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
62
+ #[ts(export, export_to = "ws/layer2.ts")]
63
+ pub struct Layer2McpPromptResponseParams {
64
+ pub agent_name: String,
65
+ pub tool: String,
66
+ pub lang: String,
67
+ pub content: String,
68
+ pub name: String,
69
+ }
70
+
71
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
72
+ #[ts(export, export_to = "ws/layer2.ts")]
73
+ pub struct Layer2SkillPromptResponseParams {
74
+ pub agent_name: String,
75
+ pub skill: String,
76
+ pub lang: String,
77
+ pub content: String,
78
+ pub name: String,
79
+ }
80
+
81
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
82
+ #[ts(export, export_to = "ws/layer2.ts")]
83
+ pub struct CustomAgentInfo {
84
+ pub name: String,
85
+ pub display_name: String,
86
+ pub description: String,
87
+ pub skills_count: usize,
88
+ pub source: String,
89
+ #[serde(default)]
90
+ #[ts(optional)]
91
+ pub version: Option<String>,
92
+ #[serde(default)]
93
+ #[ts(optional)]
94
+ pub last_updated: Option<String>,
95
+ }
96
+
97
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
98
+ #[ts(export, export_to = "ws/layer2.ts")]
99
+ pub struct CustomAgentListResponseParams {
100
+ pub agents: Vec<CustomAgentInfo>,
101
+ }
102
+
103
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
104
+ #[ts(export, export_to = "ws/layer2.ts")]
105
+ pub struct SubscribeCustomAgentResponseParams {
106
+ pub success: bool,
107
+ #[serde(default)]
108
+ #[ts(optional)]
109
+ pub error: Option<String>,
110
+ #[serde(default)]
111
+ #[ts(optional)]
112
+ pub agent: Option<CustomAgentInfo>,
113
+ #[serde(default)]
114
+ pub skills: Vec<String>,
115
+ #[serde(default)]
116
+ pub permissions: Vec<String>,
117
+ }
118
+
119
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
120
+ #[ts(export, export_to = "ws/layer2.ts")]
121
+ pub struct UnsubscribeCustomAgentResponseParams {
122
+ pub success: bool,
123
+ #[serde(default)]
124
+ #[ts(optional)]
125
+ pub error: Option<String>,
126
+ }
@@ -0,0 +1,9 @@
1
+ //! Agent runtime & orchestration message params — lifecycle streaming,
2
+ //! task management, state snapshots, the YOLO autonomous loop, and the
3
+ //! layer-2 / custom-agent registry.
4
+
5
+ pub mod agent_lifecycle;
6
+ pub mod layer2;
7
+ pub mod state_sync;
8
+ pub mod tasks;
9
+ pub mod yolo;
@@ -0,0 +1,111 @@
1
+ //! State sync / snapshots — global, container, and task snapshots.
2
+
3
+ use serde::{Deserialize, Serialize};
4
+ use ts_rs::TS;
5
+
6
+ use crate::{AgentBadge, ContainerStatus, TaskStatus, TuiAgentInfo};
7
+
8
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
9
+ #[ts(export, export_to = "ws/stateSync.ts")]
10
+ pub struct ContainerInfo {
11
+ pub id: String,
12
+ pub name: String,
13
+ pub status: ContainerStatus,
14
+ pub cpu_usage: f64,
15
+ pub memory_mb: u64,
16
+ #[serde(default)]
17
+ pub image: String,
18
+ #[serde(default)]
19
+ #[ts(optional)]
20
+ pub agent_type: Option<String>,
21
+ #[serde(default)]
22
+ #[ts(optional)]
23
+ pub parent_id: Option<String>,
24
+ #[serde(default)]
25
+ pub branch_level: u32,
26
+ #[serde(default)]
27
+ pub is_cosmos: bool,
28
+ #[serde(default)]
29
+ #[ts(optional)]
30
+ pub branch: Option<String>,
31
+ #[serde(default)]
32
+ pub is_read_only: bool,
33
+ #[serde(default)]
34
+ #[ts(type = "string")]
35
+ #[ts(optional)]
36
+ pub badge: Option<AgentBadge>,
37
+ #[serde(default)]
38
+ #[ts(optional)]
39
+ pub current_skill: Option<String>,
40
+ #[serde(default)]
41
+ #[ts(optional)]
42
+ pub workspace_id: Option<String>,
43
+ #[serde(default)]
44
+ #[ts(optional)]
45
+ pub workspace_path: Option<String>,
46
+ #[serde(default)]
47
+ #[ts(optional)]
48
+ pub git_remote_url: Option<String>,
49
+ #[serde(default)]
50
+ #[ts(optional)]
51
+ pub git_branch: Option<String>,
52
+ }
53
+
54
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
55
+ #[ts(export, export_to = "ws/stateSync.ts")]
56
+ pub struct TaskInfo {
57
+ #[ts(type = "string")]
58
+ pub id: uuid::Uuid,
59
+ #[ts(type = "string")]
60
+ pub issue_id: uuid::Uuid,
61
+ pub title: String,
62
+ pub status: TaskStatus,
63
+ pub progress: u8,
64
+ #[serde(default)]
65
+ #[ts(optional)]
66
+ pub assigned_agent: Option<String>,
67
+ }
68
+
69
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
70
+ #[ts(export, export_to = "ws/stateSync.ts")]
71
+ pub struct GlobalSnapshotParams {
72
+ pub snapshot: GlobalSnapshotData,
73
+ }
74
+
75
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
76
+ #[ts(export, export_to = "ws/stateSync.ts")]
77
+ pub struct GlobalSnapshotData {
78
+ pub version: u64,
79
+ pub timestamp: i64,
80
+ pub agents: Vec<TuiAgentInfo>,
81
+ pub containers: Vec<ContainerInfo>,
82
+ pub active_tasks: Vec<TaskInfo>,
83
+ }
84
+
85
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
86
+ #[ts(export, export_to = "ws/stateSync.ts")]
87
+ pub struct ContainerSnapshotParams {
88
+ pub snapshot: ContainerSnapshotData,
89
+ }
90
+
91
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
92
+ #[ts(export, export_to = "ws/stateSync.ts")]
93
+ pub struct ContainerSnapshotData {
94
+ pub version: u64,
95
+ pub timestamp: i64,
96
+ pub containers: Vec<ContainerInfo>,
97
+ }
98
+
99
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
100
+ #[ts(export, export_to = "ws/stateSync.ts")]
101
+ pub struct TasksSnapshotParams {
102
+ pub snapshot: TasksSnapshotData,
103
+ }
104
+
105
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
106
+ #[ts(export, export_to = "ws/stateSync.ts")]
107
+ pub struct TasksSnapshotData {
108
+ pub version: u64,
109
+ pub timestamp: i64,
110
+ pub tasks: Vec<TaskInfo>,
111
+ }
@@ -0,0 +1,43 @@
1
+ //! Task management — task creation and status updates.
2
+
3
+ use schemars::JsonSchema;
4
+ use serde::{Deserialize, Serialize};
5
+ use ts_rs::TS;
6
+
7
+ use crate::{Agent, AgentBadge, TaskStatus};
8
+
9
+ #[derive(JsonSchema, Debug, Clone, Serialize, Deserialize, TS)]
10
+ #[ts(export, export_to = "ws/tasks.ts")]
11
+ pub struct TaskCreatedParams {
12
+ #[ts(type = "string")]
13
+ pub task_id: uuid::Uuid,
14
+ #[ts(type = "string")]
15
+ pub issue_id: uuid::Uuid,
16
+ pub title: String,
17
+ #[serde(default)]
18
+ #[ts(optional)]
19
+ pub description: Option<String>,
20
+ #[serde(default)]
21
+ #[ts(optional)]
22
+ pub assigned_agent: Option<Agent>,
23
+ #[serde(default)]
24
+ #[ts(type = "string")]
25
+ #[ts(optional)]
26
+ pub parent_task_id: Option<uuid::Uuid>,
27
+ #[serde(default)]
28
+ #[ts(type = "string")]
29
+ #[ts(optional)]
30
+ pub badge: Option<AgentBadge>,
31
+ #[serde(default)]
32
+ #[ts(optional)]
33
+ pub tags: Option<Vec<String>>,
34
+ }
35
+
36
+ #[derive(JsonSchema, Debug, Clone, Serialize, Deserialize, TS)]
37
+ #[ts(export, export_to = "ws/tasks.ts")]
38
+ pub struct TaskStatusUpdateParams {
39
+ #[ts(type = "string")]
40
+ pub task_id: uuid::Uuid,
41
+ pub status: TaskStatus,
42
+ pub progress: u8,
43
+ }
@@ -0,0 +1,161 @@
1
+ //! YOLO Cruise Control — autonomous loop status & configuration.
2
+
3
+ use serde::{Deserialize, Serialize};
4
+ use ts_rs::TS;
5
+
6
+ use crate::YoloTaskTier;
7
+
8
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
9
+ #[ts(export, export_to = "ws/yolo.ts")]
10
+ pub struct YoloStartResponseParams {
11
+ pub ok: bool,
12
+ #[serde(default)]
13
+ #[ts(optional)]
14
+ pub error: Option<String>,
15
+ }
16
+
17
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
18
+ #[ts(export, export_to = "ws/yolo.ts")]
19
+ pub struct YoloStopResponseParams {
20
+ pub ok: 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/yolo.ts")]
28
+ pub struct YoloTerminateResponseParams {
29
+ pub ok: bool,
30
+ #[serde(default)]
31
+ #[ts(optional)]
32
+ pub error: Option<String>,
33
+ }
34
+
35
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
36
+ #[ts(export, export_to = "ws/yolo.ts")]
37
+ pub struct YoloTaskResult {
38
+ pub success: bool,
39
+ pub duration_ms: u64,
40
+ pub completed_at: String,
41
+ #[serde(default)]
42
+ #[ts(optional)]
43
+ pub error: Option<String>,
44
+ }
45
+
46
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
47
+ #[ts(export, export_to = "ws/yolo.ts")]
48
+ pub struct YoloTaskStatus {
49
+ pub agent: String,
50
+ pub skill: String,
51
+ pub enabled: bool,
52
+ #[serde(default)]
53
+ #[ts(optional)]
54
+ pub last_result: Option<YoloTaskResult>,
55
+ }
56
+
57
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
58
+ #[ts(export, export_to = "ws/yolo.ts")]
59
+ pub struct YoloTierStatus {
60
+ pub tier: YoloTaskTier,
61
+ pub enabled: bool,
62
+ pub interval_secs: u64,
63
+ #[serde(default)]
64
+ #[ts(optional)]
65
+ pub last_run_at: Option<String>,
66
+ #[serde(default)]
67
+ #[ts(optional)]
68
+ pub next_run_at: Option<String>,
69
+ #[serde(default)]
70
+ pub tasks: Vec<YoloTaskStatus>,
71
+ }
72
+
73
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
74
+ #[ts(export, export_to = "ws/yolo.ts")]
75
+ pub struct YoloStatusResponseParams {
76
+ pub active: bool,
77
+ pub loop_count: u64,
78
+ #[serde(default)]
79
+ #[ts(optional)]
80
+ pub started_at: Option<String>,
81
+ #[serde(default)]
82
+ #[ts(optional)]
83
+ pub current_cycle: Option<String>,
84
+ #[serde(default)]
85
+ pub tiers: Vec<YoloTierStatus>,
86
+ }
87
+
88
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
89
+ #[ts(export, export_to = "ws/yolo.ts")]
90
+ pub struct YoloCycleStepParams {
91
+ pub skill: String,
92
+ pub loop_count: u64,
93
+ pub status: String,
94
+ #[serde(default)]
95
+ #[ts(optional)]
96
+ pub token_usage: Option<(u32, u32)>,
97
+ #[serde(default)]
98
+ #[ts(optional)]
99
+ pub model_name: Option<String>,
100
+ }
101
+
102
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
103
+ #[ts(export, export_to = "ws/yolo.ts")]
104
+ pub struct YoloCycleCompleteParams {
105
+ pub loop_count: u64,
106
+ pub duration_ms: u64,
107
+ }
108
+
109
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
110
+ #[ts(export, export_to = "ws/yolo.ts")]
111
+ pub struct YoloTierTaskConfig {
112
+ pub agent: String,
113
+ pub skill: String,
114
+ #[serde(default = "crate::default_true")]
115
+ pub enabled: bool,
116
+ }
117
+
118
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
119
+ #[ts(export, export_to = "ws/yolo.ts")]
120
+ pub struct YoloTierConfig {
121
+ pub tier: YoloTaskTier,
122
+ #[serde(default)]
123
+ pub enabled: bool,
124
+ #[serde(default)]
125
+ pub interval_secs: u64,
126
+ #[serde(default)]
127
+ pub tasks: Vec<YoloTierTaskConfig>,
128
+ }
129
+
130
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
131
+ #[ts(export, export_to = "ws/yolo.ts")]
132
+ pub struct YoloConfigResponseParams {
133
+ pub tiers: Vec<YoloTierConfig>,
134
+ }
135
+
136
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
137
+ #[ts(export, export_to = "ws/yolo.ts")]
138
+ pub struct YoloUpdateTaskResponseParams {
139
+ pub ok: bool,
140
+ #[serde(default)]
141
+ #[ts(optional)]
142
+ pub error: Option<String>,
143
+ }
144
+
145
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
146
+ #[ts(export, export_to = "ws/yolo.ts")]
147
+ pub struct YoloSetTierIntervalResponseParams {
148
+ pub ok: bool,
149
+ #[serde(default)]
150
+ #[ts(optional)]
151
+ pub error: Option<String>,
152
+ }
153
+
154
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
155
+ #[ts(export, export_to = "ws/yolo.ts")]
156
+ pub struct YoloRunTierNowResponseParams {
157
+ pub ok: bool,
158
+ #[serde(default)]
159
+ #[ts(optional)]
160
+ pub error: Option<String>,
161
+ }
package/src/ws/mod.rs ADDED
@@ -0,0 +1,10 @@
1
+ //! WebSocket TUI message domains — the variant params of the platform's
2
+ //! `SyncMessage` enum, mirroring entelecheia's `tui_types/message/types`.
3
+ //!
4
+ //! Each submodule's types are re-exported at the crate root
5
+ //! (`arona::TypeName`); the TypeScript bindings land under `ws/*.ts`, matching
6
+ //! the `#[ts(export_to = "ws/…")]` attributes on every type defined here.
7
+
8
+ pub mod agent;
9
+ pub mod services;
10
+ pub mod ui;
@@ -0,0 +1,99 @@
1
+ //! Authentication — login/register/user-management responses.
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/auth.ts")]
8
+ pub struct AuthLoginResponseParams {
9
+ pub ok: bool,
10
+ #[serde(default)]
11
+ #[ts(optional)]
12
+ pub token: Option<String>,
13
+ #[serde(default)]
14
+ #[ts(optional)]
15
+ pub session_id: Option<String>,
16
+ #[serde(default)]
17
+ #[ts(optional)]
18
+ pub user_id: Option<String>,
19
+ #[serde(default)]
20
+ #[ts(optional)]
21
+ pub username: Option<String>,
22
+ #[serde(default)]
23
+ #[ts(optional)]
24
+ pub display_name: Option<String>,
25
+ #[serde(default)]
26
+ #[ts(optional)]
27
+ pub role: Option<String>,
28
+ #[serde(default)]
29
+ #[ts(optional)]
30
+ pub error: Option<String>,
31
+ }
32
+
33
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
34
+ #[ts(export, export_to = "ws/auth.ts")]
35
+ pub struct AuthRegisterResponseParams {
36
+ pub ok: bool,
37
+ #[serde(default)]
38
+ #[ts(optional)]
39
+ pub user_id: Option<String>,
40
+ #[serde(default)]
41
+ #[ts(optional)]
42
+ pub username: Option<String>,
43
+ #[serde(default)]
44
+ #[ts(optional)]
45
+ pub error: Option<String>,
46
+ }
47
+
48
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
49
+ #[ts(export, export_to = "ws/auth.ts")]
50
+ pub struct UserProfileSummary {
51
+ pub id: String,
52
+ pub username: String,
53
+ pub email: String,
54
+ pub display_name: String,
55
+ pub role: String,
56
+ pub is_active: bool,
57
+ }
58
+
59
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
60
+ #[ts(export, export_to = "ws/auth.ts")]
61
+ pub struct AuthListUsersResponseParams {
62
+ pub ok: bool,
63
+ #[serde(default)]
64
+ #[ts(optional)]
65
+ pub users: Option<Vec<UserProfileSummary>>,
66
+ #[serde(default)]
67
+ #[ts(optional)]
68
+ pub error: Option<String>,
69
+ }
70
+
71
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
72
+ #[ts(export, export_to = "ws/auth.ts")]
73
+ pub struct AuthGetUserResponseParams {
74
+ pub ok: bool,
75
+ #[serde(default)]
76
+ #[ts(optional)]
77
+ pub user: Option<UserProfileSummary>,
78
+ #[serde(default)]
79
+ #[ts(optional)]
80
+ pub error: Option<String>,
81
+ }
82
+
83
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
84
+ #[ts(export, export_to = "ws/auth.ts")]
85
+ pub struct AuthDeleteUserResponseParams {
86
+ pub ok: bool,
87
+ #[serde(default)]
88
+ #[ts(optional)]
89
+ pub error: Option<String>,
90
+ }
91
+
92
+ #[derive(Debug, Clone, Serialize, Deserialize, TS)]
93
+ #[ts(export, export_to = "ws/auth.ts")]
94
+ pub struct AuthChangePasswordResponseParams {
95
+ pub ok: bool,
96
+ #[serde(default)]
97
+ #[ts(optional)]
98
+ pub error: Option<String>,
99
+ }