[3/12] feat: native ASR platform — sherpa runtime, Parakeet client, model catalog & lifecycle - #12
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Introduces the core “native ASR platform” foundations for the Windows app: sherpa-onnx runtime loading (CPU/CUDA), model catalog + lifecycle management (download/verify/delete), and native clients for streaming (Parakeet) and batch/offline transcription, along with progress reporting utilities.
Changes:
- Add native sherpa runtime loader (
NativeSherpaRuntime) plus safe archive extraction helper (SafeArchiveExtractor) and ship a CUDA runtime manifest/content. - Implement Parakeet streaming client + PCM normalization + timestamp segmentation, and add offline/native model client plus a unified transcription client wrapper.
- Add model definitions/catalog and lifecycle services (status snapshots, download/verify/delete, progress).
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| windows-native/Muesli.Windows/Services/TranscriptionProgress.cs | Defines transcription stage + progress payload used by long-running imports/transcription. |
| windows-native/Muesli.Windows/Services/ThrottledTranscriptionProgress.cs | Throttles progress callbacks to avoid WPF dispatcher starvation during decoding. |
| windows-native/Muesli.Windows/Services/TranscriptionModels.cs | Adds shared DTOs for transcription/model operations and download progress display. |
| windows-native/Muesli.Windows/Services/TranscriptionModelCatalog.cs | Adds pinned model catalog and cache utilities for native offline models. |
| windows-native/Muesli.Windows/Services/TranscriptionModelLifecycleService.cs | Adds per-model lifecycle operations (prepare/verify/delete/cancel/retry) and snapshots for UI. |
| windows-native/Muesli.Windows/Services/NativeTranscriptionClient.cs | Provides a role-scoped “single selected model” wrapper over Parakeet vs offline clients. |
| windows-native/Muesli.Windows/Services/NativeParakeetClient.cs | Implements Parakeet (sherpa-onnx) client with download/verify, provider selection, and file transcription. |
| windows-native/Muesli.Windows/Services/NativeOfflineAsrClient.cs | Implements offline/batch ASR models via sherpa-onnx with pinned-file verification and chunked decoding. |
| windows-native/Muesli.Windows/Services/StreamingPcmNormalizer.cs | Normalizes live PCM input to 16kHz mono float samples for streaming ASR input. |
| windows-native/Muesli.Windows/Services/ParakeetTimestampSegmenter.cs | Produces timestamped transcript segments using token timestamps with fallbacks. |
| windows-native/Muesli.Windows/Services/SafeArchiveExtractor.cs | Adds archive-slip protection for model extraction into cache directories. |
| windows-native/Muesli.Windows/Services/NativeSherpaRuntime.cs | Adds CPU vs CUDA sherpa runtime discovery/loading and diagnostic surfacing. |
| windows-native/Muesli.Windows/Services/StreamingModelPlatform.cs | Adds streaming model catalog + installer + lifecycle service for live meeting models (incl. VAD). |
| windows-native/Muesli.Windows/Services/ModelSetupArtifactCleaner.cs | Adds cleanup for partial/staging artifacts from interrupted downloads/extractions. |
| windows-native/Muesli.Windows/NativeRuntime/SherpaOnnxCuda/native-sherpa-cuda-runtime.json | Adds CUDA runtime manifest describing required runtime + NVIDIA dependency DLLs. |
| windows-native/Muesli.Windows/Muesli.Windows.csproj | Adds sherpa-onnx + SharpCompress package refs and ships CUDA runtime content to output/publish. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| (name.EndsWith(".partial", StringComparison.OrdinalIgnoreCase) || | ||
| name.EndsWith(".download", StringComparison.OrdinalIgnoreCase))) | ||
| { | ||
| CapturedAudio.TryDelete(file); |
| var genericBytes = Directory.Exists(ModelCacheDirectory) | ||
| ? Directory.EnumerateFiles(ModelCacheDirectory, "*", SearchOption.AllDirectories) | ||
| .Sum(path => new FileInfo(path).Length) | ||
| : 0; |
| public long DiskSizeBytes() => Directory.Exists(_model.ModelPath) | ||
| ? Directory.EnumerateFiles(_model.ModelPath, "*", SearchOption.AllDirectories).Sum(path => new FileInfo(path).Length) | ||
| : 0; |
| using var input = entry.OpenEntryStream(); | ||
| using var output = new FileStream(destination, FileMode.Create, FileAccess.Write, FileShare.None); | ||
| input.CopyTo(output); | ||
| output.Flush(flushToDisk: true); |
| lock (state.Gate) | ||
| { | ||
| state.Status = null; | ||
| state.Detail = "Cancelled; safe partial artifacts will be cleaned on retry."; | ||
| } |
Adds NativeSherpaRuntime to resolve and load the bundled sherpa-onnx native libraries (CPU and CUDA), SafeArchiveExtractor for path-traversal safe model unpacking, and ModelSetupArtifactCleaner to reclaim partial downloads. Wires the sherpa-onnx and SharpCompress package references and ships the CUDA runtime manifest. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Introduces a common TranscriptionProgress contract plus a throttling wrapper so long transcriptions can report progress without flooding the UI dispatcher. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Adds the sherpa-onnx Parakeet client for streaming recognition, a timestamp segmenter that turns token timings into readable segments, and a PCM normaliser that converts capture buffers to the model's expected sample rate and format. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
42033f8 to
e097c53
Compare
|
Claude finished @Mvkd108's task in 9m 14s —— View job Code Review — PR #12 (3/12: native ASR platform)
This is review-only per the PR description (nothing wired up yet), so feedback below is about correctness/robustness of this chunk in isolation. Already fixed since the earlier Copilot review
Findings
None of the above are blockers for "review only, do not merge" — flagging for the maintainers to address before PR 9/10 wires this platform up and before Branch: |
Describes the supported ASR models, their download sources, on-disk layout and hardware requirements in one place so download, qualification and UI all agree on what is installable. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Adds the batch (non-streaming) recognition path used for file imports and post-meeting finalisation, sharing model resolution and progress reporting with the streaming client. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Fronts the streaming and offline clients behind a single entry point that selects the right backend from the catalog and the user's configured model. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Handles install, verification, repair and removal of ASR models, and resolves which streaming platform (CPU or CUDA) a given model can run on for the current machine. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
e097c53 to
a121059
Compare
This PR (3/12): native ASR platform — sherpa runtime, Parakeet client, model catalog & lifecycle
Commits:
3deca7bfeat: sherpa-onnx native runtime loader and safe archive extraction —Services/NativeSherpaRuntime.cs,Services/SafeArchiveExtractor.cs,NativeRuntime/SherpaOnnxCuda/native-sherpa-cuda-runtime.json3aaac52feat: transcription progress reporting with throttling —Services/ThrottledTranscriptionProgress.cs,Services/TranscriptionProgress.cs1bc9442feat: Parakeet streaming ASR client and PCM normalisation —Services/NativeParakeetClient.cs,Services/StreamingPcmNormalizer.cs,Services/ParakeetTimestampSegmenter.cse987048feat: transcription model catalog and descriptors —Services/TranscriptionModelCatalog.cs,Services/TranscriptionModels.cs5d9a017feat: offline ASR client —Services/NativeOfflineAsrClient.csb03bafdfeat: unified native transcription client —Services/NativeTranscriptionClient.cs42033f8feat: model lifecycle management and streaming model platform —Services/TranscriptionModelLifecycleService.cs,Services/StreamingModelPlatform.cs,Services/ModelSetupArtifactCleaner.cs16 files, +4,333.
Review focus
SafeArchiveExtractor— archive-slip protection, partial-download cleanup, hash/size validation of model payloads.NativeSherpaRuntime— CPU vs CUDA runtime selection and load failure surfacing (see alsoRuntimeStatusMapperin PR 4).StreamingPcmNormalizer— all inputs normalized to 16 kHz mono before ASR (this is why the "non-stereo mic" crash class cannot occur here).TranscriptionModelCatalog/TranscriptionModelLifecycleService— model state machine (absent → downloading → ready → active), resume/retry behavior.NativeParakeetClientvsNativeOfflineAsrClient— streaming vs batch contract split behindNativeTranscriptionClient.Expected — do not flag: nothing calls this platform yet; wiring happens in PR 9/10.
Muesli.Windows.csprojchanges are package/runtime references only.Known limits
Test evidence
--no-restore); 484/484 passing.TranscriptionModelPlatformTests,ModelAndSingleInstanceTests.Previous: #11 | Next: #13