8dad52f040
新增画布Agent会话契约、领域规则、SpacetimeDB元数据表和生成绑定。 新增api-server画布Agent会话CRUD、OSS消息文档读写、SSE消息流和生成工具编排。 新增前端右侧Agent对话面板、会话状态hook、SSE客户端、BFF客户端和相关测试。 调整画布侧栏、任务栏、小地图默认状态和面板互斥交互。 补齐画布Agent、OSS消息存储、SSE收口、后端契约和项目记忆文档。
137 lines
4.9 KiB
Rust
137 lines
4.9 KiB
Rust
use super::*;
|
|
|
|
impl SpacetimeClient {
|
|
pub async fn create_editor_agent_conversation(
|
|
&self,
|
|
input: EditorAgentConversationCreateRecordInput,
|
|
) -> Result<EditorAgentConversationRecord, SpacetimeClientError> {
|
|
let procedure_input = input.into();
|
|
|
|
self.call_after_connect(
|
|
"create_editor_agent_conversation_and_return",
|
|
move |connection, sender| {
|
|
connection
|
|
.procedures()
|
|
.create_editor_agent_conversation_and_return_then(
|
|
procedure_input,
|
|
move |_, result| {
|
|
let mapped = result
|
|
.map_err(SpacetimeClientError::from_sdk_error)
|
|
.and_then(map_editor_agent_conversation_procedure_result);
|
|
send_once(&sender, mapped);
|
|
},
|
|
);
|
|
},
|
|
)
|
|
.await
|
|
}
|
|
|
|
pub async fn list_editor_agent_conversations(
|
|
&self,
|
|
project_id: String,
|
|
owner_user_id: String,
|
|
) -> Result<Vec<EditorAgentConversationRecord>, SpacetimeClientError> {
|
|
let procedure_input = EditorAgentConversationListInput {
|
|
project_id,
|
|
owner_user_id,
|
|
};
|
|
|
|
self.call_after_connect(
|
|
"list_editor_agent_conversations_and_return",
|
|
move |connection, sender| {
|
|
connection
|
|
.procedures()
|
|
.list_editor_agent_conversations_and_return_then(
|
|
procedure_input,
|
|
move |_, result| {
|
|
let mapped = result
|
|
.map_err(SpacetimeClientError::from_sdk_error)
|
|
.and_then(map_editor_agent_conversation_list_procedure_result);
|
|
send_once(&sender, mapped);
|
|
},
|
|
);
|
|
},
|
|
)
|
|
.await
|
|
}
|
|
|
|
pub async fn get_editor_agent_conversation(
|
|
&self,
|
|
conversation_id: String,
|
|
owner_user_id: String,
|
|
) -> Result<EditorAgentConversationRecord, SpacetimeClientError> {
|
|
let procedure_input = EditorAgentConversationGetInput {
|
|
conversation_id,
|
|
owner_user_id,
|
|
};
|
|
|
|
self.call_after_connect(
|
|
"get_editor_agent_conversation_and_return",
|
|
move |connection, sender| {
|
|
connection
|
|
.procedures()
|
|
.get_editor_agent_conversation_and_return_then(
|
|
procedure_input,
|
|
move |_, result| {
|
|
let mapped = result
|
|
.map_err(SpacetimeClientError::from_sdk_error)
|
|
.and_then(map_editor_agent_conversation_procedure_result);
|
|
send_once(&sender, mapped);
|
|
},
|
|
);
|
|
},
|
|
)
|
|
.await
|
|
}
|
|
|
|
pub async fn touch_editor_agent_conversation(
|
|
&self,
|
|
input: EditorAgentConversationTouchRecordInput,
|
|
) -> Result<EditorAgentConversationRecord, SpacetimeClientError> {
|
|
let procedure_input = input.into();
|
|
|
|
self.call_after_connect(
|
|
"touch_editor_agent_conversation_and_return",
|
|
move |connection, sender| {
|
|
connection
|
|
.procedures()
|
|
.touch_editor_agent_conversation_and_return_then(
|
|
procedure_input,
|
|
move |_, result| {
|
|
let mapped = result
|
|
.map_err(SpacetimeClientError::from_sdk_error)
|
|
.and_then(map_editor_agent_conversation_procedure_result);
|
|
send_once(&sender, mapped);
|
|
},
|
|
);
|
|
},
|
|
)
|
|
.await
|
|
}
|
|
|
|
pub async fn delete_editor_agent_conversation(
|
|
&self,
|
|
input: EditorAgentConversationDeleteRecordInput,
|
|
) -> Result<EditorAgentConversationRecord, SpacetimeClientError> {
|
|
let procedure_input = input.into();
|
|
|
|
self.call_after_connect(
|
|
"delete_editor_agent_conversation_and_return",
|
|
move |connection, sender| {
|
|
connection
|
|
.procedures()
|
|
.delete_editor_agent_conversation_and_return_then(
|
|
procedure_input,
|
|
move |_, result| {
|
|
let mapped = result
|
|
.map_err(SpacetimeClientError::from_sdk_error)
|
|
.and_then(map_editor_agent_conversation_procedure_result);
|
|
send_once(&sender, mapped);
|
|
},
|
|
);
|
|
},
|
|
)
|
|
.await
|
|
}
|
|
}
|