From cdccb7a06a2b8ce98e3853135428552c7749da67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Fri, 2 Oct 2026 19:14:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=8A=A0=E5=9B=BE=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E7=BC=96=E8=BE=91=E8=B0=83=E7=94=A8=E4=B8=8A=E5=86=97?= =?UTF-8?q?=E4=BD=99=E7=9A=84=E5=87=AD=E6=8D=AE=20wrapper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - remove_background_payload 的恢复与派生两处不再套 with_direct_editor_api_credentials_as:整个 payload 已在 bridge_remove_background 的 with_direct_editor_api_credentials 作用域内,内层凭据解析只会命中 override - 因此 ResourceEditError::Other 作为 credentials_error 的分支不可达,删掉以免误导(凭据失败仍按原路径落到 CredentialsUnavailable) - 保留 Box::pin(资源编辑 future 体积问题不变),注释改为同时说明装箱原因与凭据作用域来源 --- .../src-tauri/src/agent/direct_tool_bridge.rs | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) 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)