Detect connectors used in external agent sessions (#36336)

## What changed

- Add session connector detection to `ExternalAgentConfigService` for Claude and Cursor migrations.
- Resolve Claude connector attributions through session manifests and map Cursor `CallMcpTool` server IDs through cached plugin metadata.
- Return deduplicated connector candidates with their session counts and detection sources, and expose the new result types from the migration crate.

## Testing

- Cover Claude connector resolution by server name and UUID.
- Cover Cursor connector detection and per-session counting from MCP tool calls.

GitOrigin-RevId: 772bfe949bdc734b385a6e06f6a4b1d35b4cf210
This commit is contained in:
charlesgong-openai authored and copyberry committed 2026-07-31 14:35:55 +00:00
1 parent ef293f7ac9
commit 448118f544
9 files changed
+479 -19

No files matched your search

@@ -6,7 +6,10 @@ use crate::config_values::write_toml_file;
use crate::memory_import;
use crate::migration_source::ExternalAgentSource;
use crate::migration_source::InstructionSourceGroup;
pub use crate::model::DetectedConnectorCandidate;
pub use crate::model::DetectedConnectorSource;
pub use crate::model::ExternalAgentConfigDetectOptions;
pub use crate::model::ExternalAgentConfigDetection;
pub use crate::model::ExternalAgentConfigImportItemResult;
pub use crate::model::ExternalAgentConfigImportOutcome;
pub use crate::model::ExternalAgentConfigImportRawError;
@@ -24,6 +27,7 @@ use crate::reporting::emit_migration_metric;
use crate::reporting::migration_metric_tags;
pub use crate::reporting::record_import_error;
use crate::scope::MigrationScope;
use crate::sessions::ExternalAgentSessionMigration;
use crate::sessions::SessionMetadataMode;
#[cfg(test)]
use crate::source_cla::KNOWN_MARKETPLACES_PATH as EXTERNAL_AGENT_KNOWN_MARKETPLACES_PATH;
@@ -118,6 +122,17 @@ impl ExternalAgentConfigService {
&self.connector_metadata_roots
}
pub fn detect_session_connectors(
&self,
sessions: &[ExternalAgentSessionMigration],
) -> Vec<DetectedConnectorCandidate> {
self.source.detect_session_connectors(
sessions,
&self.connector_metadata_roots,
&self.external_agent_home,
)
}
pub fn codex_home(&self) -> &Path {
&self.codex_home
}