Files
codex/codex-rs/model-provider-info/src/capabilities.rs
T
jamy-OAI 708e3e2c70 Allow providers to opt into Cyber access programs (#58190)
## Why

Cyber access program selection was restricted to the `openai` provider ID, preventing custom providers from accepting explicit program selections.

## What changed

- Add `capabilities.cyber_access_programs` to provider configuration and preserve it through remote thread configuration. Default to enabled for `openai` and disabled for other provider IDs, with explicit overrides taking precedence.
- Use the capability when forwarding `access_programs.cyber` and determining Daybreak availability in exec and the TUI. Refresh TUI eligibility when the server changes the selected provider.
- Preserve authentication, API-key feature gates, and catalog access checks; the capability does not grant program access.

## Testing

Add coverage for capability defaults and overrides, configuration round trips, custom-provider requests with both authentication types, API-key feature gating, compaction, WebSocket response reuse, exec selection, and TUI provider changes.

GitOrigin-RevId: 579f7c33c9e857ff5fedd08311aa8e3129740c1f
2026-10-29 23:24:52 +00:00

33 lines
1.4 KiB
Rust

//! Serializable capability overrides for custom Responses-compatible providers.
//!
//! Unspecified capabilities inherit the provider's existing defaults. Model and
//! turn settings may further restrict the capabilities declared here.
use schemars::JsonSchema;
use serde::Deserialize;
use serde::Serialize;
/// Overrides for the optional API features supported by a custom provider.
#[derive(Debug, Clone, Copy, Default, Deserialize, Serialize, PartialEq, Eq, JsonSchema)]
#[schemars(deny_unknown_fields)]
pub struct ModelProviderCapabilities {
/// Whether the provider accepts explicit `access_programs.cyber` selections.
/// Defaults to enabled for the built-in OpenAI provider and disabled otherwise.
/// This does not grant program access or change authentication.
pub cyber_access_programs: Option<bool>,
/// Whether hosted web search may access the live web.
pub external_web_access: Option<bool>,
/// Remote context-compaction protocol; omission preserves provider defaults.
pub remote_compaction: Option<RemoteCompactionSupport>,
}
/// Remote context-compaction protocols supported by a model provider.
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum RemoteCompactionSupport {
/// Use local compaction instead of a provider compaction protocol.
Unsupported,
/// Send `compaction_trigger` items over the Responses endpoint.
V2,
}