合并 origin/master(AGC 统一错误诊断 / 图集连通域切分)
- 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 等命令,两侧新增全部保留 - 冲突原为纯追加,按"两侧语义都保住"处理;未跑测试
This commit is contained in:
@@ -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<String, String> {
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user