feat: add Apple SpeechAnalyzer (macOS 26+) batch transcription backend - #1
Open
mlaplante wants to merge 14 commits into
Open
feat: add Apple SpeechAnalyzer (macOS 26+) batch transcription backend#1mlaplante wants to merge 14 commits into
mlaplante wants to merge 14 commits into
Conversation
Add the Apple SpeechAnalyzer/SpeechTranscriber Swift<->Rust FFI bridge scaffold (Task 1 of the apple-speechanalyzer-backend plan), mirroring the existing apple_intelligence real/stub/header pattern so build.rs stays uniform. - speech_analyzer_bridge.h declares the full C surface (available, locale_installed, install_locale, transcribe, supported_locales_json, free, free_str). - speech_analyzer.swift implements availability + supported_locales for real against the macOS 26 Speech framework; install_locale/transcribe are error-returning placeholders wired up in later tasks. - speech_analyzer_stub.swift mirrors every symbol for toolchains/SDKs without Speech.framework, so both build configs link identically. - build.rs compiles the bridge via swiftc + libtool into a static archive and links -framework Speech -framework AVFoundation. Unlike the FoundationModels bridge, Speech's SpeechAnalyzer/SpeechTranscriber types compile under a Command-Line-Tools-only swiftc, so the real/stub gate only checks for Speech.framework's presence in the SDK (plus a HANDY_FORCE_SPEECH_STUB escape hatch). - apple_speech.rs provides the safe Rust wrapper with a cfg-gated real impl (macOS/aarch64) and a cross-platform stub, plus availability/ locales unit tests proving the module is total and never panics. Verified on this machine (CLT-only Swift 6.4 / SDK 27): the real bridge compiles and links, apple_speech::available() returns true, and supported_locales() returns 47 real BCP-47 locales from SpeechTranscriber.supportedLocales.
…andbox-entitlement note
…le(equivalentTo:) for availability & locale resolution
mlaplante
force-pushed
the
feat/apple-speechanalyzer-backend
branch
from
July 14, 2026 12:59
d8baf26 to
0f6c321
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Apple's on-device SpeechAnalyzer / SpeechTranscriber (Speech framework, macOS 26+) as a batch transcription backend, selectable in the model list as "Built-in (Apple)". No downloadable weights — the OS holds the model. macOS/Apple-Silicon only; the feature is compiled out (inert stub) on every other platform.
How it works:
src-tauri/swift/speech_analyzer*.swift+apple_speech.rs), mirroring the existingapple_intelligencebridge and compiled bybuild.rs(linksSpeech/AVFoundation).EngineType::AppleSpeech,ModelSource::System,LoadedEngine::AppleSpeech; availability-gated catalog entry.AVAudioConverter→SpeechAnalyzer.start/finalizeAndFinishThroughEndOfInput→ draintranscriber.results.SpeechTranscriber.isAvailable; locale resolution via Apple'sSpeechTranscriber.supportedLocale(equivalentTo:).Design spec and implementation plan are committed under
docs/superpowers/.Before Submitting This PR
Please confirm you have done the following:
Fixes #
Discussion:
Community Feedback
N/A for this fork PR. Upstream Handy is under a feature freeze; proposing this to
cjpais/Handywould require gathering community support via Discussions first.Testing
cargo test --lib: 132 passing, including new unit tests for locale resolution, availability gating, and catalog injection (present-iff-available, no id collision).SpeechTranscriber.isAvailable == true, and locale resolution (en→en-US,zh-Hant→zh-TW, bogusxx-YY→nil).bun run build(tsc + vite) green; bothcargo build(real bridge) andHANDY_FORCE_SPEECH_STUB=1 cargo build(stub config) link.bun run tauri dev) and produced a release.appbundle for parallel manual testing.speech-recognitionentitlement is documented but untested (App Sandbox isn't enabled); catalog speed/accuracy scores are placeholders, not benchmarked.AI Assistance
If AI was used:
docs/superpowers/specs/anddocs/superpowers/plans/capture the design and plan.