diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/direct_tool_bridge.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/direct_tool_bridge.rs index 1755adff8..31cd98b59 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/direct_tool_bridge.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/direct_tool_bridge.rs @@ -2568,15 +2568,14 @@ async fn remove_background_payload( return Err(RemoveBackgroundError::DuplicatePendingOperations); } let completed = if let Some(pending) = matching_pending.into_iter().next() { - // 资源编辑的 future 很大;装箱后只留一个指针进 `handle_direct_tool_bridge` 的状态机, - // 避免把调试测试线程的默认栈顶穿。 - Box::pin(with_direct_editor_api_credentials_as( - resume_local_project_resource_edit_typed(ResumeLocalProjectResourceEditInput { + // 资源编辑的 future 很大,装箱避免顶穿 `handle_direct_tool_bridge` 的调试测试线程栈; + // 凭据作用域由外层 `with_direct_editor_api_credentials` 覆盖,这里不再套一层。 + Box::pin(resume_local_project_resource_edit_typed( + ResumeLocalProjectResourceEditInput { project_path: state.root.to_string_lossy().into_owned(), expected_project_id: manifest.project_id.clone(), operation_id: pending.operation_id, - }), - ResourceEditError::Other, + }, )) .await .map_err(RemoveBackgroundError::from_resource_edit_error)? @@ -2610,14 +2609,11 @@ async fn remove_background_payload( background_mode: Some(input.background_mode.clone()), screen_color: input.screen_color.clone(), }; - // 资源编辑的 future 很大;装箱后只留一个指针进 `handle_direct_tool_bridge` 的状态机, - // 避免把调试测试线程的默认栈顶穿。 - Box::pin(with_direct_editor_api_credentials_as( - derive_local_project_resource_typed(request), - ResourceEditError::Other, - )) - .await - .map_err(RemoveBackgroundError::from_resource_edit_error)? + // 资源编辑的 future 很大,装箱避免顶穿 `handle_direct_tool_bridge` 的调试测试线程栈; + // 凭据作用域由外层 `with_direct_editor_api_credentials` 覆盖,这里不再套一层。 + Box::pin(derive_local_project_resource_typed(request)) + .await + .map_err(RemoveBackgroundError::from_resource_edit_error)? }; emit_game_creator_manifest_invalidated(&state.root, "direct-background-removal"); bridge_completed_resource_result(&state.root, "background-removal", "derive", completed)