From 49882c330e604267fcd53cfe968fe507f68969ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Tue, 15 Sep 2026 19:52:01 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80=20DirectProject=20=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=E8=AE=A2=E9=98=85=E8=B7=AF=E5=BE=84=E8=BA=AB=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 订阅端复用 canonical project identity 并匹配 Windows 路径归一化。 --- apps/ai-game-creator-shell/src-tauri/src/agent.rs | 3 ++- .../codex_app_server/direct_project_identity.rs | 2 +- .../src-tauri/src/agent/codex_app_server/mod.rs | 2 +- .../ai-game-creator-shell/src-tauri/src/commands.rs | 13 +++++++++++-- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent.rs b/apps/ai-game-creator-shell/src-tauri/src/agent.rs index 0e5076fef..2593543ce 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent.rs @@ -36,7 +36,8 @@ mod runtime_tools; mod skill_pack; use codex_app_server::*; pub(crate) use codex_app_server::{ - direct_game_creator_codex_chat_at, direct_game_creator_home_codex_chat, + direct_codex_canonical_project_identity, direct_game_creator_codex_chat_at, + direct_game_creator_home_codex_chat, }; use codex_cli::*; pub(crate) use codex_cli::{ diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/codex_app_server/direct_project_identity.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/codex_app_server/direct_project_identity.rs index 4454a2a48..5ec9f28a1 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/codex_app_server/direct_project_identity.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/codex_app_server/direct_project_identity.rs @@ -3,7 +3,7 @@ use super::super::*; use sha2::{Digest, Sha256}; -pub(super) fn direct_codex_canonical_project_identity( +pub(crate) fn direct_codex_canonical_project_identity( root: &std::path::Path, ) -> Result<(std::path::PathBuf, String), String> { let (canonical_root, _) = resolve_direct_codex_project_authority(root)?; diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/codex_app_server/mod.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/codex_app_server/mod.rs index b38fe27af..df41bd8f7 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/codex_app_server/mod.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/codex_app_server/mod.rs @@ -13,7 +13,7 @@ use uuid::Uuid; mod direct_project_history_wire; use direct_project_history_wire::build_direct_project_history_injection_params; mod direct_project_identity; -use direct_project_identity::*; +pub(crate) use direct_project_identity::direct_codex_canonical_project_identity; const GAME_CREATOR_CODEX_APP_SERVER_PROVIDER_ID: &str = "genarrative_agc"; const GAME_CREATOR_CODEX_APP_SERVER_API_KEY_ENV: &str = "GENARRATIVE_AGC_CODEX_API_KEY"; 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 b70b8c6d7..eab8dfde0 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/commands.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/commands.rs @@ -1,5 +1,8 @@ use super::*; -use crate::agent::{read_direct_project_chat_history_at, read_direct_project_last_item_id_at}; +use crate::agent::{ + direct_codex_canonical_project_identity, read_direct_project_chat_history_at, + read_direct_project_last_item_id_at, +}; use crate::ui_editor::resource::font::FontAsset; use sha2::{Digest, Sha256}; use std::collections::{BTreeMap, HashSet}; @@ -5281,7 +5284,13 @@ pub(crate) fn subscribe_direct_project_thread( ) -> Result { let root = Path::new(project_path.trim()); enforce_project_permission_policy(root, "conversation.read")?; - let thread_id = root.to_string_lossy().into_owned(); + let (canonical_root, _) = direct_codex_canonical_project_identity(root)?; + let thread_root = canonical_root + .to_str() + .and_then(|value| value.strip_prefix("\\\\?\\")) + .map(Path::new) + .unwrap_or(canonical_root.as_path()); + let thread_id = thread_root.to_string_lossy().into_owned(); let mut bootstrap = subscribe_direct_thread(&thread_id); if bootstrap.last_completed_item_id.is_none() { bootstrap.last_completed_item_id = read_direct_project_last_item_id_at(root)?;