@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
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
use serde_json::Value;
|
|
2
|
+
use uuid::Uuid;
|
|
3
|
+
|
|
4
|
+
use crate::enums::ConsultationStatus;
|
|
5
|
+
|
|
6
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
7
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
8
|
+
pub struct TriggerAddResult {
|
|
9
|
+
pub trigger_id: Uuid,
|
|
10
|
+
pub trigger_type: String,
|
|
11
|
+
#[ts(type = "Record<string, unknown>")]
|
|
12
|
+
pub event: Value,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
16
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
17
|
+
pub struct TriggerEntry {
|
|
18
|
+
pub id: String,
|
|
19
|
+
pub trigger_type: String,
|
|
20
|
+
#[ts(type = "Record<string, unknown>")]
|
|
21
|
+
pub event: Value,
|
|
22
|
+
pub created_at: String,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
26
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
27
|
+
pub struct TriggerListResult {
|
|
28
|
+
pub count: usize,
|
|
29
|
+
pub triggers: Vec<TriggerEntry>,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
33
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
34
|
+
pub struct TriggerRemoveResult {
|
|
35
|
+
pub trigger_id: Uuid,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
39
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
40
|
+
pub struct TaskScheduleResult {
|
|
41
|
+
pub task_id: Uuid,
|
|
42
|
+
#[ts(type = "Record<string, unknown>")]
|
|
43
|
+
pub schedule: Value,
|
|
44
|
+
pub status: ConsultationStatus,
|
|
45
|
+
pub timer_info: Option<String>,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
49
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
50
|
+
pub struct TaskEntry {
|
|
51
|
+
pub id: String,
|
|
52
|
+
#[ts(type = "Record<string, unknown>")]
|
|
53
|
+
pub schedule: Value,
|
|
54
|
+
pub status: ConsultationStatus,
|
|
55
|
+
pub created_at: String,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
59
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
60
|
+
pub struct TaskListResult {
|
|
61
|
+
pub count: usize,
|
|
62
|
+
pub tasks: Vec<TaskEntry>,
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
66
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
67
|
+
pub struct TaskCancelResult {
|
|
68
|
+
pub task_id: Uuid,
|
|
69
|
+
pub status: ConsultationStatus,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// ── Tool parameter structs (for .d.ts API signature generation) ──
|
|
73
|
+
|
|
74
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
75
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
76
|
+
pub struct DeliverMessageParams {
|
|
77
|
+
pub target_badge: String,
|
|
78
|
+
pub message_type: String,
|
|
79
|
+
pub content: String,
|
|
80
|
+
pub suggested_skill: Option<String>,
|
|
81
|
+
pub priority: Option<String>,
|
|
82
|
+
pub source_badge: Option<String>,
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
86
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
87
|
+
pub struct InjectUserPromptParams {
|
|
88
|
+
pub target_badge: String,
|
|
89
|
+
pub message: String,
|
|
90
|
+
pub source_badge: Option<String>,
|
|
91
|
+
pub suggested_skill: Option<String>,
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
95
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
96
|
+
pub struct ConsumeInjectedPromptsParams {
|
|
97
|
+
pub target_badge: String,
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
101
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
102
|
+
pub struct ForkContainerOnNextActionParams {
|
|
103
|
+
pub container_id: String,
|
|
104
|
+
pub branch_prefix: Option<String>,
|
|
105
|
+
pub reason: Option<String>,
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
109
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
110
|
+
pub struct NotifyFileOperationParams {
|
|
111
|
+
pub file_path: String,
|
|
112
|
+
pub agent_type: String,
|
|
113
|
+
pub instance_badge: Option<String>,
|
|
114
|
+
pub observation_type: Option<String>,
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
118
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
119
|
+
pub struct ListFileObserversParams {
|
|
120
|
+
pub file_path: String,
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// ── Tool result structs ──
|
|
124
|
+
|
|
125
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
126
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
127
|
+
pub struct DeliverMessageResult {
|
|
128
|
+
pub todo_id: Uuid,
|
|
129
|
+
pub title: String,
|
|
130
|
+
pub target_badge: String,
|
|
131
|
+
pub status: String,
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
135
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
136
|
+
pub struct InjectUserPromptResult {
|
|
137
|
+
pub target_badge: String,
|
|
138
|
+
pub injected: bool,
|
|
139
|
+
pub prompt_count: usize,
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
143
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
144
|
+
pub struct InjectedPromptView {
|
|
145
|
+
pub source_badge: String,
|
|
146
|
+
pub message: String,
|
|
147
|
+
pub suggested_skill: String,
|
|
148
|
+
pub injected_at: String,
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
152
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
153
|
+
pub struct ConsumeInjectedPromptsResult {
|
|
154
|
+
pub consumed: Vec<InjectedPromptView>,
|
|
155
|
+
pub count: usize,
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
159
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
160
|
+
pub struct ForkContainerRegistrationResult {
|
|
161
|
+
pub status: String,
|
|
162
|
+
pub message: String,
|
|
163
|
+
pub container_id: String,
|
|
164
|
+
pub reason: String,
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
168
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
169
|
+
pub struct NotifyFileOperationToolResult {
|
|
170
|
+
pub file_path: String,
|
|
171
|
+
pub observers_count: usize,
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
175
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
176
|
+
pub struct FileObserverView {
|
|
177
|
+
pub agent_type: String,
|
|
178
|
+
pub instance_badge: Option<String>,
|
|
179
|
+
pub observation_type: String,
|
|
180
|
+
pub registered_at: String,
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
184
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
185
|
+
pub struct ListFileObserversToolResult {
|
|
186
|
+
pub file_path: String,
|
|
187
|
+
pub observers: Vec<FileObserverView>,
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
191
|
+
#[ts(export, export_to = "mcp/epieikeia.ts")]
|
|
192
|
+
pub struct UnregisterFileOperationResult {
|
|
193
|
+
pub status: String,
|
|
194
|
+
}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
use crate::enums::{
|
|
2
|
+
ConversationMessageType, ConversationStatus, FileOperationType, ObservationType,
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
6
|
+
#[ts(export, export_to = "mcp/haplotes.ts")]
|
|
7
|
+
pub struct LlmProviderCallResult {
|
|
8
|
+
pub model: String,
|
|
9
|
+
pub tokens: String,
|
|
10
|
+
pub response: String,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS, PartialEq, Eq, Hash)]
|
|
14
|
+
#[ts(export, export_to = "mcp/haplotes.ts")]
|
|
15
|
+
pub struct AgentReference {
|
|
16
|
+
pub agent_type: String,
|
|
17
|
+
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
18
|
+
pub instance_badge: Option<String>,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
22
|
+
#[ts(export, export_to = "mcp/haplotes.ts")]
|
|
23
|
+
pub struct FileLineRange {
|
|
24
|
+
pub start: u32,
|
|
25
|
+
pub end: u32,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
29
|
+
#[ts(export, export_to = "mcp/haplotes.ts")]
|
|
30
|
+
pub struct ConflictInfo {
|
|
31
|
+
pub conflict_id: String,
|
|
32
|
+
pub file_path: String,
|
|
33
|
+
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
34
|
+
pub line_range: Option<FileLineRange>,
|
|
35
|
+
pub conflicting_agent: AgentReference,
|
|
36
|
+
pub operation_type: FileOperationType,
|
|
37
|
+
pub since: String,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
41
|
+
#[ts(export, export_to = "mcp/haplotes.ts")]
|
|
42
|
+
pub struct ObserverInfo {
|
|
43
|
+
pub agent: AgentReference,
|
|
44
|
+
pub observation_type: ObservationType,
|
|
45
|
+
pub since: String,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
49
|
+
#[ts(export, export_to = "mcp/haplotes.ts")]
|
|
50
|
+
pub struct NotifyFileOperationResult {
|
|
51
|
+
pub file_path: String,
|
|
52
|
+
pub observers_count: usize,
|
|
53
|
+
pub conflicts: Vec<ConflictInfo>,
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
57
|
+
#[ts(export, export_to = "mcp/haplotes.ts")]
|
|
58
|
+
pub struct ListFileObserversResult {
|
|
59
|
+
pub file_path: String,
|
|
60
|
+
pub observers: Vec<ObserverInfo>,
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
64
|
+
#[ts(export, export_to = "mcp/haplotes.ts")]
|
|
65
|
+
pub struct AgentReasoning {
|
|
66
|
+
pub what: String,
|
|
67
|
+
pub why: String,
|
|
68
|
+
pub how: String,
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/// Structured reason-evaluation triples for agent self-reflection.
|
|
72
|
+
/// Semantically distinct from [`AgentReasoning`] — this is the context of
|
|
73
|
+
/// the ongoing conversation, not the agent's own reasoning chain.
|
|
74
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
75
|
+
#[ts(export, export_to = "mcp/haplotes.ts")]
|
|
76
|
+
pub struct ConversationContext {
|
|
77
|
+
pub what: String,
|
|
78
|
+
pub why: String,
|
|
79
|
+
pub how: String,
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
83
|
+
#[ts(export, export_to = "mcp/haplotes.ts")]
|
|
84
|
+
pub struct FileAnchor {
|
|
85
|
+
pub file_path: String,
|
|
86
|
+
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
87
|
+
pub line_start: Option<u32>,
|
|
88
|
+
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
89
|
+
pub line_end: Option<u32>,
|
|
90
|
+
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
91
|
+
pub snapshot_hash: Option<String>,
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
95
|
+
#[ts(export, export_to = "mcp/haplotes.ts")]
|
|
96
|
+
pub struct ConversationMessage {
|
|
97
|
+
pub id: String,
|
|
98
|
+
pub author: AgentReference,
|
|
99
|
+
pub content: AgentReasoning,
|
|
100
|
+
pub message_type: ConversationMessageType,
|
|
101
|
+
pub created_at: String,
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
105
|
+
#[ts(export, export_to = "mcp/haplotes.ts")]
|
|
106
|
+
pub struct AgentConversation {
|
|
107
|
+
pub id: String,
|
|
108
|
+
pub topic: String,
|
|
109
|
+
pub status: ConversationStatus,
|
|
110
|
+
pub initiator: AgentReference,
|
|
111
|
+
pub participants: Vec<AgentReference>,
|
|
112
|
+
pub context: ConversationContext,
|
|
113
|
+
pub messages: Vec<ConversationMessage>,
|
|
114
|
+
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
115
|
+
pub file_anchor: Option<FileAnchor>,
|
|
116
|
+
pub created_at: String,
|
|
117
|
+
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
118
|
+
pub resolved_at: Option<String>,
|
|
119
|
+
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
120
|
+
pub human_consultation_id: Option<String>,
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
124
|
+
#[ts(export, export_to = "mcp/haplotes.ts")]
|
|
125
|
+
pub struct AskAgentResult {
|
|
126
|
+
pub conversation_id: String,
|
|
127
|
+
pub status: ConversationStatus,
|
|
128
|
+
pub created_at: String,
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
132
|
+
#[ts(export, export_to = "mcp/haplotes.ts")]
|
|
133
|
+
pub struct ReplyAgentResult {
|
|
134
|
+
pub conversation_id: String,
|
|
135
|
+
pub status: ConversationStatus,
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
139
|
+
#[ts(export, export_to = "mcp/haplotes.ts")]
|
|
140
|
+
pub struct EscalateConversationResult {
|
|
141
|
+
pub conversation_id: String,
|
|
142
|
+
pub human_consultation_id: String,
|
|
143
|
+
pub escalated_at: String,
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
147
|
+
#[ts(export, export_to = "mcp/haplotes.ts")]
|
|
148
|
+
pub struct ListConversationsResult {
|
|
149
|
+
pub count: usize,
|
|
150
|
+
pub conversations: Vec<AgentConversation>,
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
154
|
+
#[ts(export, export_to = "mcp/haplotes.ts")]
|
|
155
|
+
pub struct GetConversationResult {
|
|
156
|
+
pub conversation: AgentConversation,
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// ── Tool parameter structs (for .d.ts API signature generation) ──
|
|
160
|
+
|
|
161
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
162
|
+
#[ts(export, export_to = "mcp/haplotes.ts")]
|
|
163
|
+
pub struct ChatMessage {
|
|
164
|
+
pub role: String,
|
|
165
|
+
pub content: String,
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
169
|
+
#[ts(export, export_to = "mcp/haplotes.ts")]
|
|
170
|
+
pub struct LlmProviderCallParams {
|
|
171
|
+
pub tier: Option<String>,
|
|
172
|
+
pub messages: Vec<ChatMessage>,
|
|
173
|
+
pub temperature: Option<f64>,
|
|
174
|
+
pub max_tokens: Option<u64>,
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
|
|
178
|
+
#[ts(export, export_to = "mcp/haplotes.ts")]
|
|
179
|
+
pub struct SubscribeTriggerParams {
|
|
180
|
+
pub topic_pattern: String,
|
|
181
|
+
pub agent_id: Option<String>,
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
#[cfg(test)]
|
|
185
|
+
mod tests {
|
|
186
|
+
use super::*;
|
|
187
|
+
use anyhow::Result;
|
|
188
|
+
|
|
189
|
+
#[test]
|
|
190
|
+
fn test_agent_reference_with_badge() -> Result<()> {
|
|
191
|
+
let ar = AgentReference {
|
|
192
|
+
agent_type: "WebAutomation".to_string(),
|
|
193
|
+
instance_badge: Some("#002".to_string()),
|
|
194
|
+
};
|
|
195
|
+
let json = serde_json::to_string(&ar)?;
|
|
196
|
+
let de: AgentReference = serde_json::from_str(&json)?;
|
|
197
|
+
assert_eq!(de.agent_type, "WebAutomation");
|
|
198
|
+
assert_eq!(de.instance_badge, Some("#002".to_string()));
|
|
199
|
+
Ok(())
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
#[test]
|
|
203
|
+
fn test_agent_reference_without_badge() -> Result<()> {
|
|
204
|
+
let ar = AgentReference {
|
|
205
|
+
agent_type: "HubRis".to_string(),
|
|
206
|
+
instance_badge: None,
|
|
207
|
+
};
|
|
208
|
+
let json = serde_json::to_string(&ar)?;
|
|
209
|
+
let de: AgentReference = serde_json::from_str(&json)?;
|
|
210
|
+
assert_eq!(de.instance_badge, None);
|
|
211
|
+
Ok(())
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
#[test]
|
|
215
|
+
fn test_conflict_info_serialization() -> Result<()> {
|
|
216
|
+
let ci = ConflictInfo {
|
|
217
|
+
conflict_id: "cflict-001".to_string(),
|
|
218
|
+
file_path: "src/auth.rs".to_string(),
|
|
219
|
+
line_range: Some(FileLineRange { start: 10, end: 20 }),
|
|
220
|
+
conflicting_agent: AgentReference {
|
|
221
|
+
agent_type: "WebAutomation".to_string(),
|
|
222
|
+
instance_badge: Some("#002".to_string()),
|
|
223
|
+
},
|
|
224
|
+
operation_type: FileOperationType::Editing,
|
|
225
|
+
since: "2026-05-11T10:30:00Z".to_string(),
|
|
226
|
+
};
|
|
227
|
+
let json = serde_json::to_string(&ci)?;
|
|
228
|
+
let de: ConflictInfo = serde_json::from_str(&json)?;
|
|
229
|
+
assert_eq!(de.conflict_id, "cflict-001");
|
|
230
|
+
assert_eq!(de.file_path, "src/auth.rs");
|
|
231
|
+
assert_eq!(de.operation_type, FileOperationType::Editing);
|
|
232
|
+
Ok(())
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
#[test]
|
|
236
|
+
fn test_agent_reasoning_structure() -> Result<()> {
|
|
237
|
+
let r = AgentReasoning {
|
|
238
|
+
what: "refactoring auth".to_string(),
|
|
239
|
+
why: "security audit requirement".to_string(),
|
|
240
|
+
how: "extract AuthProvider trait".to_string(),
|
|
241
|
+
};
|
|
242
|
+
let json = serde_json::to_string(&r)?;
|
|
243
|
+
let de: AgentReasoning = serde_json::from_str(&json)?;
|
|
244
|
+
assert_eq!(de.what, "refactoring auth");
|
|
245
|
+
assert_eq!(de.why, "security audit requirement");
|
|
246
|
+
Ok(())
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
#[test]
|
|
250
|
+
fn test_conversation_status_roundtrip() -> Result<()> {
|
|
251
|
+
let statuses = vec![
|
|
252
|
+
ConversationStatus::Active,
|
|
253
|
+
ConversationStatus::Resolved,
|
|
254
|
+
ConversationStatus::Deadlocked,
|
|
255
|
+
ConversationStatus::Escalated,
|
|
256
|
+
];
|
|
257
|
+
for s in statuses {
|
|
258
|
+
let json = serde_json::to_string(&s)?;
|
|
259
|
+
let de: ConversationStatus = serde_json::from_str(&json)?;
|
|
260
|
+
assert_eq!(s, de);
|
|
261
|
+
}
|
|
262
|
+
Ok(())
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
#[test]
|
|
266
|
+
fn test_conversation_message_types() -> Result<()> {
|
|
267
|
+
let types = vec![
|
|
268
|
+
ConversationMessageType::Question,
|
|
269
|
+
ConversationMessageType::Answer,
|
|
270
|
+
ConversationMessageType::Clarification,
|
|
271
|
+
ConversationMessageType::Objection,
|
|
272
|
+
ConversationMessageType::CounterProposal,
|
|
273
|
+
ConversationMessageType::Resolution,
|
|
274
|
+
];
|
|
275
|
+
assert_eq!(types.len(), 6);
|
|
276
|
+
for t in types {
|
|
277
|
+
let json = serde_json::to_string(&t)?;
|
|
278
|
+
let de: ConversationMessageType = serde_json::from_str(&json)?;
|
|
279
|
+
assert_eq!(t, de);
|
|
280
|
+
}
|
|
281
|
+
Ok(())
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
#[test]
|
|
285
|
+
fn test_notify_result_serialization() -> Result<()> {
|
|
286
|
+
let r = NotifyFileOperationResult {
|
|
287
|
+
file_path: "src/main.rs".to_string(),
|
|
288
|
+
observers_count: 2,
|
|
289
|
+
conflicts: vec![],
|
|
290
|
+
};
|
|
291
|
+
let json = serde_json::to_string(&r)?;
|
|
292
|
+
let de: NotifyFileOperationResult = serde_json::from_str(&json)?;
|
|
293
|
+
assert_eq!(de.observers_count, 2);
|
|
294
|
+
assert!(de.conflicts.is_empty());
|
|
295
|
+
Ok(())
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
#[test]
|
|
299
|
+
fn test_ask_agent_result_serialization() -> Result<()> {
|
|
300
|
+
let r = AskAgentResult {
|
|
301
|
+
conversation_id: "conv-001".to_string(),
|
|
302
|
+
status: ConversationStatus::Active,
|
|
303
|
+
created_at: "2026-05-11T10:30:00Z".to_string(),
|
|
304
|
+
};
|
|
305
|
+
let json = serde_json::to_string(&r)?;
|
|
306
|
+
let de: AskAgentResult = serde_json::from_str(&json)?;
|
|
307
|
+
assert_eq!(de.conversation_id, "conv-001");
|
|
308
|
+
Ok(())
|
|
309
|
+
}
|
|
310
|
+
}
|