align session detector source names

This commit is contained in:
charlesgong-openai
2026-07-09 20:29:54 -04:00
parent c4173cfb0e
commit c6bd7ff875
5 changed files with 34 additions and 24 deletions
@@ -20,8 +20,8 @@ use codex_core_plugins::marketplace_add::is_local_marketplace_source;
use codex_external_agent_migration::count_missing_subagents;
use codex_external_agent_migration::missing_subagent_names;
use codex_external_agent_sessions::ExternalAgentSessionMigration;
use codex_external_agent_sessions::detect_recent_cursor_sessions;
use codex_external_agent_sessions::detect_recent_sessions;
use codex_external_agent_sessions::detect_recent_cl_sessions;
use codex_external_agent_sessions::detect_recent_cu_sessions;
use codex_plugin::PluginId;
use codex_protocol::protocol::Product;
use serde_json::Value as JsonValue;
@@ -783,10 +783,10 @@ impl ExternalAgentConfigService {
if repo_root.is_none() && self.source.supports(SourceFeature::Sessions) {
let sessions = match self.source {
ExternalAgentSource::Cl => {
detect_recent_sessions(&self.external_agent_home, &self.codex_home)?
detect_recent_cl_sessions(&self.external_agent_home, &self.codex_home)?
}
ExternalAgentSource::Cu => {
detect_recent_cursor_sessions(&self.external_agent_home, &self.codex_home)?
detect_recent_cu_sessions(&self.external_agent_home, &self.codex_home)?
}
};
if !sessions.is_empty() {
@@ -13,7 +13,7 @@ use std::time::Duration;
const SESSION_IMPORT_MAX_COUNT: usize = 50;
const SESSION_IMPORT_MAX_AGE: Duration = Duration::from_secs(30 * 24 * 60 * 60);
pub fn detect_recent_sessions(
pub fn detect_recent_cl_sessions(
external_agent_home: &Path,
codex_home: &Path,
) -> io::Result<Vec<ExternalAgentSessionMigration>> {
@@ -135,7 +135,8 @@ mod tests {
],
);
let sessions = detect_recent_sessions(&external_agent_home, root.path()).expect("detect");
let sessions =
detect_recent_cl_sessions(&external_agent_home, root.path()).expect("detect");
assert_eq!(
sessions,
@@ -163,7 +164,8 @@ mod tests {
],
);
let sessions = detect_recent_sessions(&external_agent_home, root.path()).expect("detect");
let sessions =
detect_recent_cl_sessions(&external_agent_home, root.path()).expect("detect");
assert_eq!(
sessions,
@@ -190,7 +192,8 @@ mod tests {
],
);
let sessions = detect_recent_sessions(&external_agent_home, root.path()).expect("detect");
let sessions =
detect_recent_cl_sessions(&external_agent_home, root.path()).expect("detect");
assert_eq!(
sessions,
@@ -218,7 +221,8 @@ mod tests {
],
);
let sessions = detect_recent_sessions(&external_agent_home, root.path()).expect("detect");
let sessions =
detect_recent_cl_sessions(&external_agent_home, root.path()).expect("detect");
assert_eq!(
sessions,
@@ -247,7 +251,8 @@ mod tests {
)],
);
let sessions = detect_recent_sessions(&external_agent_home, root.path()).expect("detect");
let sessions =
detect_recent_cl_sessions(&external_agent_home, root.path()).expect("detect");
assert_eq!(
sessions,
@@ -276,7 +281,7 @@ mod tests {
);
assert!(
detect_recent_sessions(&external_agent_home, root.path())
detect_recent_cl_sessions(&external_agent_home, root.path())
.expect("detect")
.is_empty()
);
@@ -313,7 +318,8 @@ mod tests {
let mut all_sessions = expected.clone();
all_sessions.push(oldest_session.clone());
let sessions = detect_recent_sessions(&external_agent_home, root.path()).expect("detect");
let sessions =
detect_recent_cl_sessions(&external_agent_home, root.path()).expect("detect");
assert_eq!(sessions, expected);
for session in sessions {
@@ -321,7 +327,8 @@ mod tests {
.expect("record import");
}
let sessions = detect_recent_sessions(&external_agent_home, root.path()).expect("detect");
let sessions =
detect_recent_cl_sessions(&external_agent_home, root.path()).expect("detect");
assert_eq!(sessions, vec![oldest_session.clone()]);
for session in sessions {
@@ -347,7 +354,8 @@ mod tests {
);
}
let sessions = detect_recent_sessions(&external_agent_home, root.path()).expect("detect");
let sessions =
detect_recent_cl_sessions(&external_agent_home, root.path()).expect("detect");
assert_eq!(sessions, expected);
for session in sessions {
@@ -355,7 +363,8 @@ mod tests {
.expect("record import");
}
let sessions = detect_recent_sessions(&external_agent_home, root.path()).expect("detect");
let sessions =
detect_recent_cl_sessions(&external_agent_home, root.path()).expect("detect");
assert_eq!(sessions, vec![oldest_session]);
}
@@ -376,7 +385,7 @@ mod tests {
.expect("record import");
assert!(
detect_recent_sessions(&external_agent_home, root.path())
detect_recent_cl_sessions(&external_agent_home, root.path())
.expect("detect")
.is_empty()
);
@@ -405,7 +414,8 @@ mod tests {
)
.expect("update session");
let sessions = detect_recent_sessions(&external_agent_home, root.path()).expect("detect");
let sessions =
detect_recent_cl_sessions(&external_agent_home, root.path()).expect("detect");
assert_eq!(
sessions,
vec![ExternalAgentSessionMigration {
@@ -14,7 +14,7 @@ use std::time::Duration;
const SESSION_IMPORT_MAX_COUNT: usize = 50;
const SESSION_IMPORT_MAX_AGE: Duration = Duration::from_secs(30 * 24 * 60 * 60);
pub fn detect_recent_cursor_sessions(
pub fn detect_recent_cu_sessions(
external_agent_home: &Path,
codex_home: &Path,
) -> io::Result<Vec<ExternalAgentSessionMigration>> {
@@ -178,5 +178,5 @@ fn decode_cursor_project_path_from(encoded: &str, base: &Path, depth: usize) ->
}
#[cfg(test)]
#[path = "detect_cursor_tests.rs"]
#[path = "detect_cu_tests.rs"]
mod tests;
@@ -28,7 +28,7 @@ fn detects_cursor_transcript_with_project_cwd() {
.expect("transcript");
let sessions =
detect_recent_cursor_sessions(&external_agent_home, root.path()).expect("detect sessions");
detect_recent_cu_sessions(&external_agent_home, root.path()).expect("detect sessions");
assert_eq!(
sessions,
+4 -4
View File
@@ -1,7 +1,7 @@
//! Parsing and export helpers for external-agent session histories.
mod detect;
mod detect_cursor;
mod detect_cl;
mod detect_cu;
mod export;
mod ledger;
mod records;
@@ -12,8 +12,8 @@ use std::io;
use std::path::Path;
use std::path::PathBuf;
pub use detect::detect_recent_sessions;
pub use detect_cursor::detect_recent_cursor_sessions;
pub use detect_cl::detect_recent_cl_sessions;
pub use detect_cu::detect_recent_cu_sessions;
use export::load_session_for_import_with_content_sha256;
pub use ledger::CompletedExternalAgentSessionImport;
pub use ledger::has_current_session_been_imported;