kcode-speaker-v3-analysis 0.1.2

Speaker V3 analysis execution and provenance
Documentation
# Purpose

Executes the fixed Speaker V3 Gemini and Terra analysis protocol.

# Public API

```rust
pub use kcode_speaker_v3_schema::{
    FEATURE_NAMES, FEATURE_SCHEMA_REVISION, FeatureVector24, LocalSpeakerLabel,
    OggAudioMetadata, StructuredAnalysis, StructuredSpeaker, ValidationError,
    VocalGenderPresentation, MAX_AUDIO_DURATION_MS, OGG_MEDIA_TYPE,
};
pub use kcode_speaker_v3_llm_protocol::{
    GEMINI_FEATURE_PROMPT_ONE, GEMINI_FEATURE_PROMPT_ONE_REVISION,
    GEMINI_FEATURE_PROMPT_REVISIONS, GEMINI_FEATURE_PROMPT_THREE,
    GEMINI_FEATURE_PROMPT_THREE_REVISION, GEMINI_FEATURE_PROMPT_TWO,
    GEMINI_FEATURE_PROMPT_TWO_REVISION, GEMINI_TRANSCRIPT_PROMPT,
    GEMINI_TRANSCRIPT_PROMPT_REVISION, GPT_STRUCTURING_PROMPT,
    GPT_STRUCTURING_PROMPT_REVISION,
};
pub struct GeminiCohort { pub model_id: String, pub transcript_prompt_revision: String, pub feature_prompt_revisions: [String; 3], pub feature_schema_revision: String }
impl GeminiCohort { pub fn new(model_id: impl Into<String>) -> Self; pub fn validate(&self) -> Result<(), ValidationError>; }
pub struct StructurerProvenance { pub model_id: String, pub prompt_revision: String }
impl StructurerProvenance { pub fn new(model_id: impl Into<String>) -> Self; pub fn validate(&self) -> Result<(), ValidationError>; }
pub struct AnalysisEnvelope { pub audio: OggAudioMetadata, pub analysis: StructuredAnalysis, pub gemini: GeminiCohort, pub structurer: StructurerProvenance }
impl AnalysisEnvelope { pub fn validate(&self) -> Result<(), ValidationError>; }
pub enum AnalysisError { Input(String), GeminiTranscript(String), TerraLabels(String), GeminiCache(String), GeminiFeature { speaker: LocalSpeakerLabel, packet: u8, message: String }, TerraStructuring(String), TranscriptMismatch, SpeakerSetMismatch }
impl Display for AnalysisError;
impl Error for AnalysisError;
pub struct ExecutedAnalysis { pub envelope: AnalysisEnvelope, pub label_extractor: StructurerProvenance }
#[cfg(feature = "providers")]
pub struct Analyzer { /* private fields */ }
#[cfg(feature = "providers")]
impl Analyzer { pub fn new(gemini: kcode_gemini_3_1_pro::Gemini31Pro, terra: kcode_codex_terra::CodexTerra) -> Self; pub async fn analyze_ogg(&self, bytes: &[u8], duration_ms: u64, filename: Option<String>) -> Result<ExecutedAnalysis, AnalysisError>; }
```

Re-exported schema and prompt declarations preserve the 0.1.1 contract. Public data values implement `Debug`, `Clone`, `PartialEq`, and Serde serialization where applicable.

`Analyzer` requires the default-disabled `providers` feature. It makes one Gemini transcript generation, one Terra label extraction, three Gemini feature generations per extracted label, and one Terra structuring run. Both Terra runs occur with zero labels. Zero labels skip cache and features; otherwise one Gemini cached prefix has a one-hour natural expiry. There are no retries or cache deletion.

Ogg validation precedes provider effects. The final transcript byte-equals Gemini's transcript and its speaker-label set equals the extracted set. Provider calls have remote latency; cancellation after submission and accounting can be ambiguous. Retained resources are linear in audio, transcript, evidence, and responses. Independent analyses share no analysis-level lock. Feature futures overlap and preserve speaker-first, packet order.