From a3cedb5d506c4d85f786ef91589d24920e9f306c Mon Sep 17 00:00:00 2001 From: Suzumiya Date: Tue, 15 Sep 2026 20:47:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=20origin/master=EF=BC=88AGC?= =?UTF-8?q?=20=E7=BB=9F=E4=B8=80=E9=94=99=E8=AF=AF=E8=AF=8A=E6=96=AD=20/?= =?UTF-8?q?=20=E5=9B=BE=E9=9B=86=E8=BF=9E=E9=80=9A=E5=9F=9F=E5=88=87?= =?UTF-8?q?=E5=88=86=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - commands.rs:接入 master 新增的 read_agent_runtime_error_detail 命令,并补上 prepare_local_project_asset_generation 里新增的 slice_mode / grid_x / grid_y 三个字段 - main.rs:注册 read_agent_runtime_error_detail - 保留我们这边的 read_direct_tool_calls 等命令,两侧新增全部保留 - 冲突原为纯追加,按"两侧语义都保住"处理;未跑测试 --- .../src-tauri/src/commands.rs | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/apps/ai-game-creator-shell/src-tauri/src/commands.rs b/apps/ai-game-creator-shell/src-tauri/src/commands.rs index 09fafbb2a..5b6484b27 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/commands.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/commands.rs @@ -4617,6 +4617,9 @@ pub(crate) fn prepare_local_project_asset_generation( .unwrap_or_else(|| LOCAL_PROJECT_ASSET_DEFAULT_ASSET_NAME.to_string()), replace_existing: false, slice_count: None, + slice_mode: None, + grid_x: None, + grid_y: None, }, }) } @@ -5264,6 +5267,37 @@ pub(crate) async fn read_direct_project_conversation( .map_err(|error| format!("读取 DirectProject 历史后台任务失败:{error}"))? } +#[tauri::command] +pub(crate) async fn read_agent_runtime_error_detail( + project_path: String, + detail_ref: String, +) -> Result { + tauri::async_runtime::spawn_blocking(move || { + let root = Path::new(project_path.trim()); + enforce_project_permission_policy(root, "conversation.read")?; + let relative = detail_ref.trim(); + let Some(file_name) = relative.strip_prefix(".agent/runtime/errors/") else { + return Err("错误诊断引用不在项目错误目录内".to_string()); + }; + if file_name.is_empty() + || file_name.contains(['/', '\\']) + || file_name.contains("..") + || !file_name.ends_with(".json") + { + return Err("错误诊断引用格式无效".to_string()); + } + let path = root.join(relative); + prepare_game_creator_private_path_for_read(&path, false, "统一错误诊断")?; + let bytes = std::fs::read(&path).map_err(|error| format!("读取错误诊断失败:{error}"))?; + if bytes.len() > 16 * 1024 { + return Err("错误诊断超过读取上限".to_string()); + } + let text = String::from_utf8(bytes).map_err(|_| "错误诊断不是 UTF-8 文本".to_string())?; + Ok(redact_agent_runtime_error(root, &text, 16 * 1024)) + }) + .await + .map_err(|error| format!("读取统一错误诊断后台任务失败:{error}"))? +} #[tauri::command] pub(crate) async fn read_direct_tool_calls( project_path: String,