允许损坏策划会话降级打开项目
Project CI / Repository checks (pull_request) Successful in 2m34s
Project CI / Frontend tests (pull_request) Successful in 3m12s
Project CI / Native shell tests (pull_request) Failing after 4m5s
Project CI / Backend tests (pull_request) Successful in 5m51s

会话读取失败时保留工作台与产物访问能力

新增策划会话备份重置命令,不删除工作区产物
This commit is contained in:
2026-09-12 07:33:49 +00:00
parent 74fad546ff
commit f505d2792f
3 changed files with 22 additions and 1 deletions
@@ -845,6 +845,24 @@ pub(crate) fn hydrate_design_agent_session(
Ok(Some(design_view(&session, active.is_none())))
}
#[tauri::command]
pub(crate) fn reset_design_agent_session(project_path: String) -> Result<(), String> {
let root = Path::new(project_path.trim());
enforce_project_permission_policy(root, "conversation.write")?;
design_project_id(root)?;
let _lock = acquire_game_creator_agent_runtime_project_write_lock_with_wait(
root,
"design.session-reset",
)?;
let path = crate::agent::runtime_protocol::design_session_path(root);
if path.exists() {
let backup = path.with_file_name(format!("session.corrupted.{}.json", unix_timestamp()));
std::fs::rename(&path, &backup)
.map_err(|error| format!("备份损坏的策划会话失败:{error}"))?;
}
Ok(())
}
#[tauri::command]
pub(crate) fn get_design_agent_runtime_mode(
project_path: String,
@@ -2583,6 +2583,7 @@ fn main() {
decide_planning_artifact_v2,
hydrate_planning_session_v2,
hydrate_design_agent_session,
reset_design_agent_session,
get_design_agent_runtime_mode,
set_design_agent_runtime_mode,
debug_fast_forward_design_session,
+3 -1
View File
@@ -3117,7 +3117,9 @@ export function App({
}
} catch (error) {
if (planningStartMode) {
throw error;
setPlanGddError(
`策划会话无法恢复:${error instanceof Error ? error.message : String(error)}`,
);
}
}
try {