mirror of
https://github.com/openai/codex.git
synced 2026-11-22 23:00:42 +00:00
Expose available access programs in model discovery (#44893)
## What changed Carry optional `available_access_programs` metadata through model information, presets, caches, and the TUI, and expose it as `availableAccessPrograms` in app-server `model/list` responses. Update the generated JSON schemas, TypeScript types, and Python models. Preserve the distinction between missing metadata and an empty `cyber` list. Ignore unknown cyber program names when reading the catalog so new server programs do not prevent older clients from loading it. Discovery metadata does not grant access; inference still enforces authorization. ## Testing Add coverage for absent, null, empty, and populated metadata, unknown program names, and app-server serialization. Extend cache tests and verify that online refreshes persist changed access metadata even when the catalog ETag stays unchanged. GitOrigin-RevId: b3ef5805c1c61b8d64b9b896c9c0a79120143667
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
//! Caller-specific explicit access programs advertised by the model catalog.
|
||||
//!
|
||||
//! Discovery metadata does not grant access; inference still enforces authorization.
|
||||
|
||||
use schemars::JsonSchema;
|
||||
use serde::Deserialize;
|
||||
use serde::Deserializer;
|
||||
use serde::Serialize;
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::turn_input::CyberAccessProgram;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, TS, JsonSchema)]
|
||||
pub struct ModelAccessPrograms {
|
||||
/// Accepted explicit selections. An empty list is distinct from missing metadata.
|
||||
#[serde(deserialize_with = "deserialize_known_cyber_access_programs")]
|
||||
pub cyber: Vec<CyberAccessProgram>,
|
||||
}
|
||||
|
||||
fn deserialize_known_cyber_access_programs<'de, D>(
|
||||
deserializer: D,
|
||||
) -> Result<Vec<CyberAccessProgram>, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
// New server programs must not prevent older clients from loading the catalog.
|
||||
Ok(Vec::<String>::deserialize(deserializer)?
|
||||
.into_iter()
|
||||
.filter_map(|program| serde_json::from_value(serde_json::Value::String(program)).ok())
|
||||
.collect())
|
||||
}
|
||||
Reference in New Issue
Block a user