分离 DirectProject 对话命令

新增 DirectProject 专用读写命令

恢复 legacy 对话命令的单一职责

更新工作台 DirectProject 读取调用
This commit is contained in:
2026-09-05 10:40:28 +08:00
parent 4731113d43
commit 7791bd7de0
3 changed files with 31 additions and 17 deletions
@@ -4708,12 +4708,18 @@ pub(crate) fn read_local_conversation(
) -> Result<LocalConversationResult, String> {
let root = Path::new(project_path.trim());
enforce_project_permission_policy(root, "conversation.read")?;
if agent_id.is_none() && session_id.is_none() {
return read_direct_project_chat_history_at(root);
}
read_local_conversation_for_session_at(root, agent_id.as_deref(), session_id.as_deref())
}
#[tauri::command]
pub(crate) fn read_direct_project_conversation(
project_path: String,
) -> Result<LocalConversationResult, String> {
let root = Path::new(project_path.trim());
enforce_project_permission_policy(root, "conversation.read")?;
read_direct_project_chat_history_at(root)
}
#[tauri::command]
pub(crate) fn append_local_conversation_message(
project_path: String,
@@ -4724,15 +4730,6 @@ pub(crate) fn append_local_conversation_message(
) -> Result<LocalConversationResult, String> {
let root = Path::new(project_path.trim());
enforce_project_permission_policy(root, "conversation.write")?;
if agent_id.is_none() && session_id.is_none() {
let item = direct_project_local_message_item(
&message.role,
&message.content,
message_id.as_deref(),
)?;
append_direct_project_history_item_at(root, &item)?;
return read_direct_project_chat_history_at(root);
}
let _lock = acquire_project_write_lock(root, "conversation.write")?;
match message_id.as_deref() {
Some(message_id) => append_local_conversation_message_for_session_idempotent_at(
@@ -4751,6 +4748,20 @@ pub(crate) fn append_local_conversation_message(
}
}
#[tauri::command]
pub(crate) fn append_direct_project_conversation_message(
project_path: String,
message: LocalConversationMessage,
message_id: Option<String>,
) -> Result<LocalConversationResult, String> {
let root = Path::new(project_path.trim());
enforce_project_permission_policy(root, "conversation.write")?;
let item =
direct_project_local_message_item(&message.role, &message.content, message_id.as_deref())?;
append_direct_project_history_item_at(root, &item)?;
read_direct_project_chat_history_at(root)
}
#[tauri::command]
pub(crate) fn build_local_project_index(
project_path: String,
@@ -2573,7 +2573,9 @@ fn main() {
set_active_game_creator_agent_session,
archive_game_creator_agent_session,
read_local_conversation,
read_direct_project_conversation,
append_local_conversation_message,
append_direct_project_conversation_message,
build_local_project_index,
create_local_project_checkpoint,
export_local_project_package,
+6 -5
View File
@@ -2576,11 +2576,12 @@ export function App({
: await readProjectSupervisorActiveSession(invoke, nextProjectPath);
let runtimeError = '';
const projectConversation = await invoke<LocalConversationResult>(
'read_local_conversation',
{
projectPath: nextProjectPath,
agentId: null,
},
directCodexProductRuntime
? 'read_direct_project_conversation'
: 'read_local_conversation',
directCodexProductRuntime
? { projectPath: nextProjectPath }
: { projectPath: nextProjectPath, agentId: null },
);
let supervisorConversation: LocalConversationResult | null = null;
let runtime: AgentRuntimeState | null = null;