统一 DirectProject 线程订阅路径身份

订阅端复用 canonical project identity 并匹配 Windows 路径归一化。
This commit is contained in:
2026-09-15 19:52:01 +08:00
committed by kdletters
parent c4c1428126
commit 6d351c2251
4 changed files with 15 additions and 5 deletions
@@ -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::{
@@ -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)?;
@@ -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";
@@ -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<DirectThreadSubscriptionBootstrap, String> {
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)?;