- Login: resta solo chiave API (+ header, Bedrock). Rimossi OAuth/browser, device code, refresh/revoke su auth.openai.com, PAT, agent/workload identity, runtime agent instance, backend-client e openapi-models, workspace routing. - Rimossi: generazione immagini (ext + skill imagegen), history notes, plugin remoti (catalogo, sync, share), cyber access program, daybreak, cloud config e requirements (config_server ora fail-closed), attestation, frozen cloud skills, EMA MCP auth, Codex Apps/connettori, ricerca ospitata, header/zstd/ routing/cookie del backend Codex, fallback OPENAI_API_KEY del realtime. - Messaggi d'errore senza link a chatgpt.com. - Chiavi di config legacy accettate e ignorate; feature rimosse = Stage::Removed. - Test: cancellati solo quelli del codice rimosso; test di sicurezza (sandbox estensioni, permessi, redazione, auth storage, requirements) adattati. Restano solo fallimenti d'ambiente (code-mode-host/V8, ~/.agents). - Istruzioni di sistema invariate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
72 lines
2.7 KiB
Rust
72 lines
2.7 KiB
Rust
use std::collections::HashMap;
|
|
|
|
use codex_protocol::mcp::ClientMcpExtensions;
|
|
use codex_protocol::mcp::MCP_APP_UI_EXTENSION_ID;
|
|
use codex_protocol::mcp::OPENAI_ELICITATION_EXTENSION_ID;
|
|
use codex_protocol::mcp::OPENAI_FORM_EXTENSION_ID;
|
|
use codex_protocol::mcp::OPENAI_STANDARD_FORM_INPUT_EXTENSION_ID;
|
|
use serde_json::Map;
|
|
use serde_json::Value;
|
|
|
|
/// Projects privileged capabilities only to their intended recipients.
|
|
/// User verification required the hosted plugin service and network policy metadata was only
|
|
/// offered to trusted hosted origins; aKode never connects to either, so both are stripped for
|
|
/// every server. Server names and caller-supplied capabilities grant neither.
|
|
pub(crate) fn server_mcp_extensions(extensions: &ClientMcpExtensions) -> ClientMcpExtensions {
|
|
ClientMcpExtensions::new(
|
|
extensions
|
|
.iter()
|
|
.filter(|(id, _)| *id != crate::MCP_NETWORK_POLICY_META_CAPABILITY)
|
|
.map(|(id, settings)| {
|
|
let mut settings = settings.clone();
|
|
if id == OPENAI_ELICITATION_EXTENSION_ID
|
|
&& let Some(settings) = settings.as_object_mut()
|
|
{
|
|
settings.remove("userVerification");
|
|
}
|
|
(id.to_string(), settings)
|
|
}),
|
|
)
|
|
}
|
|
|
|
/// Selects the MCP extensions Codex supports from those declared by the app-server host.
|
|
///
|
|
/// App-server clients may declare unrelated extensions. Codex retains only the
|
|
/// trusted extension namespaces it knows how to project downstream. The
|
|
/// legacy form capability is normalized into the same extension map.
|
|
pub fn client_mcp_extensions(
|
|
extensions: Option<&HashMap<String, Value>>,
|
|
legacy_openai_form_elicitation: bool,
|
|
) -> ClientMcpExtensions {
|
|
let mut selected = extensions
|
|
.into_iter()
|
|
.flat_map(HashMap::iter)
|
|
.filter(|(id, _)| {
|
|
matches!(
|
|
id.as_str(),
|
|
OPENAI_FORM_EXTENSION_ID
|
|
| OPENAI_ELICITATION_EXTENSION_ID
|
|
| OPENAI_STANDARD_FORM_INPUT_EXTENSION_ID
|
|
| MCP_APP_UI_EXTENSION_ID
|
|
)
|
|
})
|
|
.map(|(id, value)| (id.clone(), value.clone()))
|
|
.collect::<HashMap<_, _>>();
|
|
if let Some(settings) = selected
|
|
.get_mut(OPENAI_ELICITATION_EXTENSION_ID)
|
|
.and_then(Value::as_object_mut)
|
|
{
|
|
settings.retain(|key, _| key == "form");
|
|
}
|
|
if legacy_openai_form_elicitation {
|
|
selected
|
|
.entry(OPENAI_FORM_EXTENSION_ID.to_string())
|
|
.or_insert_with(|| Value::Object(Map::new()));
|
|
}
|
|
ClientMcpExtensions::new(selected)
|
|
}
|
|
|
|
#[cfg(test)]
|
|
#[path = "client_capabilities_tests.rs"]
|
|
mod tests;
|