kcode-k1-full-audio 0.2.0

Durable orchestration of full audio into classified overlapping K1 fragments
Documentation
# Full audio

`K1FullAudio` synchronously converts a complete media value, fragments the normalized Ogg Opus stream, submits every fragment for classification, and stores one private manifest Object.

## Public API

- `pub type FullAudioId = kcode_k1_objects::TxId` is the manifest Object transaction ID.
- `pub struct K1FullAudio` is the facade.
- `FullAudioState` derives `Clone`, `Debug`, `Eq`, and `PartialEq` and has `Processing`, `AwaitingLabels`, `NeedsAttention`, and `Complete` variants.
- `FullAudioFragmentStatus` derives `Clone`, `Debug`, and `PartialEq`; its public fields are `fragment_id: FragmentId`, `start_sample_48k: u64`, `end_sample_48k: u64`, and `status: FragmentStatus`.
- `FullAudioStatus` derives `Clone`, `Debug`, and `PartialEq`; its public fields are `state: FullAudioState`, ordered `fragments: Vec<FullAudioFragmentStatus>`, and `final_transcript: Option<String>`.
- `K1FullAudio::open(ffmpeg_path: impl AsRef<Path>, objects: Arc<K1Objects>, classification: Arc<AudioClassification>) -> Result<Self, String>`, `submit(&self, audio: &[u8]) -> Result<FullAudioId, String>`, and `status(&self, id: FullAudioId) -> Result<FullAudioStatus, String>` are the complete methods.

`open` requires an absolute trusted FFmpeg path and does not probe the filesystem. The supplied Objects and classification facades provide all persistence and transaction authority.

`submit` accepts the converter's nonempty self-contained media domain, converts its first audio stream exactly through the converter, deterministically fragments it in source order, validates all fragment metadata, submits each complete fragment sequentially and strictly to classification, then saves one immutable private `k1-full-audio-manifest-v1` Object with empty filename and description. It returns that Object transaction ID without polling. Validation precedes every classification submission. Later submission failure can leave earlier harmless fragment Objects and work; no manifest is saved unless all submissions and manifest encoding succeed. Equal submissions remain independent. There is no retry, deduplication, rollback, cancellation, update, deletion, recovery log, cache, index, or background work.

Every half-open 48 kHz fragment interval has positive duration of at most 7,200,000 samples. Starts and ends strictly increase from start zero and adjacent intervals overlap. The fragmenter produces exact 720,000-sample (15-second) overlap; manifest admission intentionally accepts any positive overlap. Fragment IDs must be unique.

`status` requires a present Object with the exact private type and empty metadata, strictly decodes and validates its immutable manifest before querying one present classification status per fragment, and preserves manifest order. Unknown IDs, malformed or mismatched Objects, invalid geometry, duplicate references, missing fragment statuses, and inconsistent classification values are errors.

`NeedsAttention` takes precedence for `Failed` or `Discarded`; otherwise `Processing` covers `Queued` or `Running`. `Complete` requires every fragment to be `Confirmed` with a final transcript. A set containing only valid `Completed` and `Confirmed` fragments is otherwise `AwaitingLabels`. A confirmed fragment without a transcript or any other state with one is inconsistent.

`final_transcript` is present only for `Complete`. Deterministic stitching compares adjacent speech case-insensitively and without punctuation, ignores conforming quality and speaker prefixes for seam matching, removes only confident duplicate prefixes, preserves source text and attribution, and retains uncertain seams separated by a newline.

Calls are stateless, synchronous, nonblocking with respect to unrelated calls, and hold no package lock across conversion, fragmentation, classification, Objects, or stitching. Supplied services retain their own serialization and backpressure. Work, allocation, and owned outputs scale linearly with relevant input, fragment, manifest, status, and transcript sizes; no finite package limit, timeout, or latency bound is imposed beyond the fragment interval bound. The facade does not configure or deploy FFmpeg, providers, storage, KTO, peering, classification, or Objects, expose manifest encoding, stream partial results, edit labels, manage fragment lifecycle, infer speakers, or claim registry, Server adoption, deployment, or live behavior.