c07cf4db9f
Rolls back the v0.2.0 Qwen3 CoreML on-device ASR stack and replaces the
'local engine' UX with iOS 26 SpeechAnalyzer + DictationTranscriber only.
The 'Cloud polish after ASR' toggle (ProviderConfig.localModeCloudPolishEnabled)
lets users opt into a post-ASR DeepSeek round-trip from the local engine.
Defaults to off so the local engine stays genuinely local. New PolishError.missingAPIError
surfaces an inline 'fill in your key' warning when the toggle is on but the
Keychain is empty. DeepSeek preset default model bumped to deepseek-v4-flash.
Deleted:
- OSGKeyboard/ThirdParty/Qwen3Speech/ (74 files, ~16k LoC)
- OSGKeyboard/Services/ModelManager.swift (492)
- OSGKeyboard/Services/OnDeviceModelWarmup.swift (197)
- OSGKeyboard/Services/Qwen3ASRService.swift (257)
- OSGKeyboard/Services/ModelDownloadSourcePicker.swift (126)
- OSGKeyboard/Views/OnDeviceModelsView.swift (184)
- OSGKeyboard/Views/DownloadConfirmSheet.swift (96)
- OSGKeyboardShared/Models/OnDeviceModel.swift (140)
- OSGKeyboardShared/Services/OnDeviceModelStatus.swift (104)
- Qwen3ASRServiceProvider registration in OSGKeyboardApp
- Qwen3Speech package declaration in project.yml
- 5 .qwen3ASR enum / branch reference sites in HomeView, OnboardingView,
LocalEngineSettingsRows, FlowSessionManager, ASRService, EngineServiceLabel
- Two pre-existing Swift 6 strict-concurrency errors in
LiveDictationController + FlowSessionManager (the weak [weak self] in
detached-task MainActor.run blocks) that were blocking clean builds
Added:
- LocalModelsGroup: 'Built-in iOS SpeechAnalyzer' badge + 'Cloud polish
after ASR' Switch toggle
- PolishingService: honour localModeCloudPolishEnabled; new .missingAPIKey
error case with localised warning
- AppGroupStore.localModeCloudPolishEnabled (mirrored into App Group
so the keyboard extension honours the toggle during live dictation)
- SettingsView: show provider/api sections when local-mode cloud polish
is on so the user can paste a DeepSeek key
- FlowSessionManager: route through PolishingService for local + polish-on
flow; translate missingAPIKey into a polished warning
- KeyboardViewController: handle PolishingService.PolishError.missingAPIKey
in the keyboard-side live polish path
- CHANGELOG v0.2.1: documents the rollback + new toggle
- README.md / README.zh.md: engine matrix section, data flow note
Verified: xcodebuild -scheme OSGKeyboard -destination 'generic/platform=iOS Simulator'
build succeeds under SWIFT_STRICT_CONCURRENCY=complete.
10 KiB
10 KiB
Changelog
All notable changes to OSGKeyboard will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[Unreleased]
[0.2.1] - 2026-06-24
Removed
- Qwen3 CoreML on-device ASR stack (rolled back from v0.2.0). Deleted the vendored
Qwen3SpeechSPM package, theQwen3ASRService, theModelManager/OnDeviceModelWarmup/OnDeviceModelsView/DownloadConfirmSheetUI and downloaders, theOnDeviceModelandOnDeviceModelStatusshared models, and the correspondingLocalASRBackend.qwen3ASRenum case. Removed theQwen3ASRServiceProviderregistration inOSGKeyboardApp, theModelScope/HuggingFacemirror picker, and theQwen3SpeechSPM package declaration fromproject.yml. No more model download / loading / warm-up code paths or UI state.
Changed
- Local engine narrows to iOS ASR. The on-device engine is now exclusively iOS 26
SpeechAnalyzer+DictationTranscriber(withSFSpeechRecognizeras the pre-26 fallback). The previous.qwen3ASRbackend has been removed;LocalASRBackendretains a single.speechAnalyzercase so the next non-iOS backend can slot in without touching every call site. - Local engine is genuinely local by default. When the user picks "local" and leaves the new polish toggle off, the transcript is inserted at the cursor as-is — no cloud LLM round-trip.
- DeepSeek preset defaults to
deepseek-v4-flash. The DeepSeekLLMProvider.presetsentry'sdefaultModelwas bumped fromdeepseek-chat; existing users keep their saved model name until they re-pick the preset.
Added
- Cloud polish toggle for the local engine. Settings → On-device models → "Cloud polish after ASR". When enabled, the local-engine transcript is routed through the user's configured cloud LLM (DeepSeek by default) via the existing
PolishingService+LLMClientchain. When disabled, the local engine is ASR-only. The toggle is a plainBool(ProviderConfig.localModeCloudPolishEnabled) and persists in the App Group so the keyboard extension can honour it during live dictation. - DeepSeek API key path for the local polish flow. SettingsView reveals the
providerSection/apiSectioncards when the polish toggle is on so the user can paste a DeepSeek key into the existing Keychain-bound field.PolishingServiceshort-circuits with a newPolishError.missingAPIKeyand surfaces a localised "fill in your DeepSeek key" warning when the toggle is on but the Keychain is empty. The raw transcript is still inserted (no data loss). - iOS 26
SpeechAnalyzer+DictationTranscriberis now the documented local ASR path. The pre-v0.2.0 code already supported this; v0.2.1 makes it the default and only on-device backend and adds a "Built-in" badge on the local-engine card so users see there's nothing to download.
Fixed
- Two Swift 6 strict-concurrency issues in
LiveDictationControllerandFlowSessionManager(the weak[weak self]capture insideawait MainActor.run { }blocks) that were blockingxcodebuildclean builds underSWIFT_STRICT_CONCURRENCY=complete. The detached-task closure now re-captures the weak reference under@MainActorisolation. OpenSourceLicensesViewno longer lists the deletedspeech-swift,swift-transformers,qwen3-asr-coreml, orqwen3-asr-upstreamentries; onlyGoogle Material Iconsremains.
[0.2.0] - 2026-06-22
Added
- Local engine with on-device Qwen models: Optional Qwen3-ASR 0.6B speech recognition and Qwen3.5-0.8B text polish, fully offline after download.
- On-device model management: Download, progress, delete, and readiness status in Settings; mirror auto-selection between ModelScope and Hugging Face with fallback.
- Engine picker: Choose between local (on-device ASR + polish) and cloud (ASR + user-configured LLM polish).
- Flow session dictation: TypeWhisper-style continuous capture in the host app with keyboard handoff via App Group.
- Open-source licenses screen for bundled third-party components.
Changed
- Settings simplified: Merged language and model sections; cloud mode always enables polish (removed off/transcribe mode picker).
- Keyboard UI: Local/cloud engine badges replace the mode menu; shows model-not-downloaded guidance when the local stack is incomplete.
- iPhone only: Set
TARGETED_DEVICE_FAMILYto"1"for both targets; portrait-only orientations. - Keyboard preview always dark: Preview injects the dark palette regardless of app theme.
- Docs consistency: README/README.zh aligned to the iOS 26+ capability set.
Fixed
- ModelScope download progress: Progress now tracks byte counts instead of jumping to 50% after the first file.
- Light/Dark mode consistency for shared button/card modifiers via
@Environment(\.themePalette).
[0.1.2] - 2026-06-20
Fixed
- Light/Dark mode consistency:
cardSurface(),primaryButton(),secondaryButton(), andpillChip()view modifiers inTheme.swiftnow useViewModifierstructs that read from@Environment(\.themePalette). Previously they used hardcoded darkPaletteconstants, causing cards and buttons to always render in dark mode even when the main App was in light mode. - TestFlight error 90474 (Invalid bundle): Added
UIRequiresFullScreen: trueand all fourUISupportedInterfaceOrientationsvalues toInfo.plistviaproject.yml. The app targets iPhone + iPad (TARGETED_DEVICE_FAMILY: "1,2"), and Apple requires all four orientations for iPad multitasking; settingUIRequiresFullScreenopts out of slide-over/split-view while still satisfying the validator. - Keyboard Preview cycling: The "Tap the disc to cycle states" prompt now actually works.
KeyboardPreviewStubgained anonTapclosure wired tocyclePhase()inKeyboardPreviewSheet, which rotates.idle → .recording → .processing → .idlewith animation. Sample transcript text is shown during the.recordingphase.
Added
- Dynamic ASR locale picker: Settings now loads the full list of supported locales from
SFSpeechRecognizer.supportedLocales()on appear (off the main thread). Each locale shows an on-device badge (iPhone icon) when the device supports on-device recognition for that language — giving users confidence about which locales avoid sending audio to the cloud. A static fallback list is shown while the async load is in progress. Speech.frameworklinked to the main App target inproject.yml(needed by the new dynamic locale loader inSettingsView).
Changed
pillChip(foreground:)signature changed fromforeground: Color = Palette.textSecondarytoforeground: Color? = nil; callers that pass an explicit color are unaffected.
Note: v0.1.1 polish — this is a small follow-up to v0.1.0 focused on review-driven cleanup (theme follow-up, ASR robustness, debug-print hygiene, docs). No features are removed.
Fixed
- PrivacyInfo.xcprivacy audited for honesty: removed the three undeclared
NSPrivacyAccessedAPITypeentries (FileTimestamp/DiskSpace/SystemBootTime) the project doesn't actually use, and addedActiveKeyboards(reasonDDA9.1) to the keyboard extension's manifest becauseadvanceToNextInputMode()is in the tap path. The main App now declares onlyUserDefaults(reasonCA92.1), which is the only Required Reason API it touches. - Theme follows system appearance: main App now renders a true light palette in light mode via
ThemedRoot+EnvironmentKey<ThemePalette>. The keyboard extension deliberately stays dark (Apple's default) and now uses a transparent.background(Color.clear)so the system UI chrome shows through. - Speech Recognition permission requested on first press: added
NSSpeechRecognitionUsageDescriptionto both targets'Info.plistand an explicitSFSpeechRecognizer.requestAuthorizationcall insidepressBegan(). Without these, speech authorization could remain.deniedand recognition would fail silently. - ASRService emits a DEBUG warning when on-device recognition isn't supported, so it's obvious during dev that the request fell back to cloud.
- App Group fallback behaviour:
- In
DEBUG, a missing App Group nowfatalErrors with a precise remediation message (was a soft print +.standardfallback, which desynced the keyboard extension from the main App). - In release, the fallback is preserved but logged via
NSLog.
- In
KeyboardViewController.loadPersistedLocaleself-check (DEBUG only) prints the active provider / baseURL / masked API key / mode / locale, so the keyboard extension's view of the App Group is visible in the device console.KeyboardViewController.handleFinalTranscripttyped-error routing:LLMError.noAPIKey(401) andLLMError.http(429)now surface as red, explicit error messages instead of silently inserting the raw transcript. Network / timeout errors still fall back to the raw transcript + error badge (no data loss).PolishingServicetimeout raised from 12 s to 15 s to align withLLMClient's URL request timeout. Previously the polisher would race the network call and discard a successful response that arrived in the 12–15 s window.- DEBUG
printcleanup: the four🔥 [OSGKeyboardApp] …instrumentation prints inOSGKeyboardApp.init()and root views are now wrapped in#if DEBUG.
Added
- "Test connection" button in
APISettingsCard: fires a singlepolish("ping")round-trip and surfaces success or the typed LLM error inline. Helps the user confirm the App Group + key are working without leaving the main App. - 5 new unit tests in
OSGKeyboardTests: App Group cross-process persistence, 401 / 429 / timeout / noAPIKey catch paths, andmode = .offshort-circuit.
Changed
- README +
README.zh.md: replaced<OWNER>placeholder withhkgoodand aligned capability statements to the implemented iOS 26 path.
Known limitations
- The keyboard does not work in password fields (iOS limitation).
- Microphone requires "Allow Full Access" to be enabled in iOS Settings.
- Whisper.cpp / on-device LLM polish is intentionally out of scope for v1 (cloud-only).
[0.1.0] - 2026-06-17
Added
- First public pre-release.