From 8c9a05e71bca5c4074624c20935b7635f166f8f3 Mon Sep 17 00:00:00 2001 From: bellman Date: Fri, 15 May 2026 10:37:20 +0900 Subject: [PATCH] Restore provider compatibility diagnostics as API types Keep the G008 capability and diagnostic helpers compile-ready by restoring the public report/support/severity types that team integrations referenced after merge reconciliation. Constraint: Final G008 verification failed on missing provider capability and diagnostic type definitions. Confidence: high Scope-risk: narrow Directive: Keep provider diagnostics exported as typed API surfaces; do not replace them with ad-hoc JSON-only status fields. Tested: cargo fmt --manifest-path rust/Cargo.toml --all -- --check; git diff --check; cargo test --manifest-path rust/Cargo.toml -p api providers:: -- --nocapture --test-threads=1; cargo test --manifest-path rust/Cargo.toml -p api --test openai_compat_integration -- --nocapture --test-threads=1 Not-tested: full workspace clippy; known unrelated runtime policy_engine struct_excessive_bools remains outside G008. Co-authored-by: OmX --- rust/crates/api/src/providers/mod.rs | 49 ++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/rust/crates/api/src/providers/mod.rs b/rust/crates/api/src/providers/mod.rs index 34d69b51..0a41fd33 100644 --- a/rust/crates/api/src/providers/mod.rs +++ b/rust/crates/api/src/providers/mod.rs @@ -49,6 +49,55 @@ pub struct ModelTokenLimit { pub context_window_tokens: u32, } +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)] +#[serde(rename_all = "snake_case")] +pub enum ProviderWireProtocol { + AnthropicMessages, + OpenAiChatCompletions, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)] +#[serde(rename_all = "snake_case")] +pub enum ProviderFeatureSupport { + Supported, + Unsupported, + PassthroughAsTool, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct ProviderCapabilityReport { + pub provider: ProviderKind, + pub wire_protocol: ProviderWireProtocol, + pub auth_env: &'static str, + pub base_url_env: &'static str, + pub default_base_url: &'static str, + pub tool_calls: ProviderFeatureSupport, + pub streaming: ProviderFeatureSupport, + pub streaming_usage: ProviderFeatureSupport, + pub prompt_cache: ProviderFeatureSupport, + pub custom_parameters: ProviderFeatureSupport, + pub reasoning_effort: ProviderFeatureSupport, + pub reasoning_content_history: ProviderFeatureSupport, + pub fixed_sampling_reasoning_models: ProviderFeatureSupport, + pub web_search: ProviderFeatureSupport, + pub web_fetch: ProviderFeatureSupport, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)] +#[serde(rename_all = "snake_case")] +pub enum ProviderDiagnosticSeverity { + Info, + Warning, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize)] +pub struct ProviderDiagnostic { + pub code: &'static str, + pub severity: ProviderDiagnosticSeverity, + pub message: String, + pub action: String, +} + #[allow(clippy::struct_excessive_bools)] #[derive(Debug, Clone, PartialEq, Eq, Serialize)] pub struct ProviderDiagnostics {