mirror of
https://github.com/openai/codex.git
synced 2026-11-09 20:50:33 +00:00
Expose connector candidates in external agent detection (#36218)
## What changed - Add a `connectors` array to `ExternalAgentConfigDetectResponse` with each candidate's normalized name, detected session count, and detection source. - Define detection sources for remote MCP server configuration and session tool use, and export the corresponding JSON Schema and TypeScript types. - Default `connectors` to an empty array when deserializing responses from older servers. ## Testing - Add a protocol test covering deserialization when `connectors` is omitted. GitOrigin-RevId: b65d76791099385226ed54411f4c1ef902be43d8
This commit is contained in:
committed by
copyberry
parent
97576b1794
commit
e6cfd40c3f
@@ -714,6 +714,8 @@ pub struct ExternalAgentConfigMigrationItem {
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ExternalAgentConfigDetectResponse {
|
||||
pub items: Vec<ExternalAgentConfigMigrationItem>,
|
||||
#[serde(default)]
|
||||
pub connectors: Vec<ExternalAgentDetectedConnectorCandidate>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
||||
@@ -876,6 +878,23 @@ pub struct ExternalAgentImportedConnectorCandidate {
|
||||
pub source: ExternalAgentImportedConnectorSource,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub enum ExternalAgentDetectedConnectorSource {
|
||||
RemoteMcpServersConfig,
|
||||
SessionToolUse,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ExternalAgentDetectedConnectorCandidate {
|
||||
pub name: String,
|
||||
pub session_count: u32,
|
||||
pub source: ExternalAgentDetectedConnectorSource,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
|
||||
@@ -72,6 +72,22 @@ fn test_absolute_path() -> AbsolutePathBuf {
|
||||
absolute_path("readable")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn external_agent_config_detect_response_defaults_connectors_for_older_servers() {
|
||||
let response = serde_json::from_value::<ExternalAgentConfigDetectResponse>(json!({
|
||||
"items": [],
|
||||
}))
|
||||
.expect("older detect response should deserialize");
|
||||
|
||||
assert_eq!(
|
||||
response,
|
||||
ExternalAgentConfigDetectResponse {
|
||||
items: Vec::new(),
|
||||
connectors: Vec::new(),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thread_background_terminals_list_response_round_trips_foreign_paths() {
|
||||
for (uri, expected_cwd) in [
|
||||
|
||||
Reference in New Issue
Block a user