Files
OSGKeyboard/project.yml
T
Rocky c0c9dad149 feat(mac): add Qwen3 MLX streaming dictation
Replace the Sherpa offline pipeline with native MLX streaming, resilient model downloads, live transcript previews, and supporting tests and documentation.
2026-07-23 14:34:56 +08:00

528 lines
20 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# XcodeGen configuration for OSGKeyboard
# Run `./Scripts/generate-xcodeproj.sh` to create OSGKeyboard.xcodeproj.
# App home-screen icon: OSGKeyboard/AppIcon.icon (Icon Composer, iOS 26).
# Repo only tracks project.yml; .xcodeproj is gitignored.
name: OSGKeyboard
options:
bundleIdPrefix: com.osgkeyboard
# XcodeGen 2.37+ emits AppIcon.icon as folder.iconcomposer.icon natively.
# Older XcodeGen releases may need Scripts/patch-icon-composer.sh (fallback).
# Minimum OS: iOS 26. We dropped older iOS support so the
# legacy speech + AVAudioSession branching could be removed in
# favour of iOS 26's `SpeechAnalyzer` (always on-device) and
# `AVAudioApplication.requestRecordPermission` (iOS 17+). iPhone + iPad;
# no Mac Catalyst, no visionOS.
deploymentTarget:
iOS: "26.0"
developmentLanguage: en
createIntermediateGroups: true
generateEmptyDirectories: true
groupSortPosition: top
# v0.2.0: dropped the local `Qwen3Speech` SPM fork. The "local" engine
# now uses iOS 26 `SpeechAnalyzer` + `DictationTranscriber` exclusively,
# which keeps the iOS dependency surface at zero SPM packages / Pods /
# Carthage (matches the long-standing "zero dependencies" promise in the
# README). Optional post-ASR cloud polish routes through DeepSeek (or
# any OpenAI-compatible endpoint) using the existing `LLMClient`.
# iOS targets remain zero-SPM-linked. macOS local ASR links mlx-audio-swift
# (ThirdParty/) for Qwen3 MLX streaming; weights download via catalog.
packages:
MLXAudio:
path: ThirdParty/mlx-audio-swift
settings:
base:
SWIFT_VERSION: "6.0"
IPHONEOS_DEPLOYMENT_TARGET: "26.0"
ENABLE_USER_SCRIPT_SANDBOXING: YES
SWIFT_STRICT_CONCURRENCY: complete
GENERATE_INFOPLIST_FILE: NO
ENABLE_MODULE_VERIFIER: YES
MODULE_VERIFIER_SUPPORTED_LANGUAGES: "objective-c objective-c++"
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS: "gnu17 gnu++17"
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED: YES
ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOLS: YES
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS: YES
STRING_CATALOG_GENERATE_SYMBOLS: YES
CLANG_CXX_LANGUAGE_STANDARD: c++17
MARKETING_VERSION: "0.5.4"
CURRENT_PROJECT_VERSION: "23"
# 签名配置来自 Signing.local.xcconfiggitignored,不会被覆盖)
# 项目级签名 xcconfig,适用于所有 target
configFiles:
Debug: Signing.local.xcconfig
Release: Signing.local.xcconfig
targets:
# =========================================================
# 主 App
# =========================================================
OSGKeyboard:
type: application
platform: iOS
sources:
- path: OSGKeyboard/AppIcon.icon
buildPhase: resources
- path: OSGKeyboard
excludes:
- "AppIcon.icon"
- "OSGKeyboard.icon"
# Legacy PNG app icons must not coexist with AppIcon.icon — actool
# crashes when both are passed. iOS 26 uses Icon Composer only.
- "Assets.xcassets/AppIcon.appiconset"
- "Resources/CustomLanguageModel/**"
# Shared with the Live Activity widget so the host app can request sessions.
- path: OSGKeyboardLiveActivity/FlowActivityAttributes.swift
entitlements:
path: OSGKeyboard/OSGKeyboard.entitlements
properties:
com.apple.security.application-groups:
- group.com.osgkeyboard.shared
com.apple.security.device.audio-input: true
# Shared Keychain access group: the host app writes the LLM API
# key here in Settings; the keyboard extension reads it before
# each request. The first entry below becomes each process's
# default access group, so the Keychain helper does not need to
# specify kSecAttrAccessGroup explicitly.
keychain-access-groups:
- $(AppIdentifierPrefix)com.osgkeyboard.shared
# iCloud Key-Value Store — personal dictionary sync across
# iPhone / iPad / Mac (Designed for iPad). Main app only.
# NOTE: this entitlement is a single STRING, not an array — an
# array value never matches the profile and breaks automatic
# signing ("doesn't match the entitlements file's value").
com.apple.developer.ubiquity-kvstore-identifier: $(TeamIdentifierPrefix)com.osgkeyboard.ios
resources:
- path: OSGKeyboard/Assets.xcassets
- path: OSGKeyboard/en.lproj
- path: OSGKeyboard/zh-Hans.lproj
- path: OSGKeyboard/Resources/Fonts/MaterialIcons-Regular.ttf
- path: OSGKeyboard/Resources/PrivacyPolicy.html
- path: OSGKeyboard/PrivacyInfo.xcprivacy
info:
path: OSGKeyboard/Info.plist
properties:
CFBundleDisplayName: OSGKeyboard
CFBundleShortVersionString: "$(MARKETING_VERSION)"
CFBundleVersion: "$(CURRENT_PROJECT_VERSION)"
LSApplicationCategoryType: public.app-category.utilities
# English is the development language; zh-Hans is the only
# translation right now. The list also tells iOS to surface
# the keyboard in the per-app language picker for both.
CFBundleDevelopmentRegion: en
CFBundleLocalizations:
- en
- zh-Hans
UILaunchScreen:
UIColorName: "BackgroundColor"
UISupportedInterfaceOrientations:
- UIInterfaceOrientationPortrait
UISupportedInterfaceOrientations~ipad:
- UIInterfaceOrientationPortrait
- UIInterfaceOrientationPortraitUpsideDown
- UIInterfaceOrientationLandscapeLeft
- UIInterfaceOrientationLandscapeRight
UIApplicationSceneManifest:
UIApplicationSupportsMultipleScenes: false
NSMicrophoneUsageDescription: "OSGKeyboard uses the microphone for voice dictation and keeps a background audio session active while a voice session is running."
NSSpeechRecognitionUsageDescription: "OSGKeyboard uses on-device speech recognition to transcribe your voice. Audio is processed on your device and is not uploaded for transcription."
UIBackgroundModes:
- audio
NSSupportsLiveActivities: true
NSAppTransportSecurity:
NSAllowsArbitraryLoads: false
ITSAppUsesNonExemptEncryption: false
CFBundleURLTypes:
- CFBundleURLName: com.osgkeyboard.ios.settings
CFBundleURLSchemes:
- osgkeyboard
LSApplicationQueriesSchemes:
- weixin
- mqq
- wxwork
- dingtalk
- lark
- tg
- whatsapp
- line
- fb-messenger
- slack
- msteams
- discord
- notion
- bear
- obsidian
- drafts5
- googlegmail
- ms-outlook
- googlechrome
- sinaweibo
- xhsdiscover
- sgnl
- kakaotalk
- viber
- zalo
- skype
- zoomus
- things
- todoist
- evernote
- onenote
- readdle-spark
- firefox
- microsoft-edge
- fb
- instagram
- twitter
- barcelona
- snapchat
- reddit
- pinterest
- zhihu
- bilibili
- snssdk1128
- tiktok
# All network calls are HTTPS (NSAppTransportSecurity above);
# nothing in the app uses non-exempt encryption. Declaring
# `ITSAppUsesNonExemptEncryption: false` lets us skip the
# annual self-classification questionnaire in App Store
# Connect on every upload.
ITSAppUsesNonExemptEncryption: false
settings:
base:
PRODUCT_BUNDLE_IDENTIFIER: com.osgkeyboard.ios
TARGETED_DEVICE_FAMILY: "1,2"
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents: YES
INFOPLIST_KEY_LSApplicationCategoryType: public.app-category.utilities
SUPPORTS_MACCATALYST: NO
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD: NO
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD: NO
ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon
# TestFlight upload: Automatic signing picks the right App Store profile.
CODE_SIGN_STYLE: Automatic
DEVELOPMENT_TEAM: X329MZU23S
dependencies:
- target: OSGKeyboardShared
embed: true
- target: OSGKeyboardExt
# Keyboard Extension is a plugin of the main App; embed it.
- target: OSGKeyboardLiveActivity
embed: true
- sdk: Speech.framework
- sdk: ActivityKit.framework
- sdk: StoreKit.framework
# =========================================================
# Keyboard Extension
# =========================================================
OSGKeyboardExt:
type: app-extension
platform: iOS
sources:
- path: OSGKeyboardExt
excludes:
- "en.lproj"
- "zh-Hans.lproj"
- path: OSGKeyboardExt/en.lproj/Keyboard.strings
buildPhase: resources
- path: OSGKeyboardExt/zh-Hans.lproj/Keyboard.strings
buildPhase: resources
resources:
- path: OSGKeyboardExt/PrivacyInfo.xcprivacy
settings:
base:
IPHONEOS_DEPLOYMENT_TARGET: "26.0"
entitlements:
path: OSGKeyboardExt/OSGKeyboardExt.entitlements
properties:
com.apple.security.application-groups:
- group.com.osgkeyboard.shared
# Shared with the host app so the keyboard extension can read the
# user's LLM API key. See OSGKeyboard/OSGKeyboard.entitlements
# for the full rationale.
keychain-access-groups:
- $(AppIdentifierPrefix)com.osgkeyboard.shared
info:
path: OSGKeyboardExt/Info.plist
properties:
CFBundleDisplayName: OSGKeyboard
CFBundleShortVersionString: "$(MARKETING_VERSION)"
CFBundleVersion: "$(CURRENT_PROJECT_VERSION)"
CFBundleDevelopmentRegion: en
CFBundleLocalizations:
- en
- zh-Hans
NSMicrophoneUsageDescription: "OSGKeyboard uses the microphone for voice dictation and keeps a background audio session active while a voice session is running."
NSSpeechRecognitionUsageDescription: "OSGKeyboard uses on-device speech recognition to transcribe your voice. Audio is processed on your device and is not uploaded for transcription."
NSExtension:
NSExtensionAttributes:
IsASCIICapable: false
PrefersRightToLeft: false
PrimaryLanguage: "mis"
RequestsOpenAccess: true
NSExtensionPointIdentifier: com.apple.keyboard-service
NSExtensionPrincipalClass: $(PRODUCT_MODULE_NAME).KeyboardViewController
settings:
base:
PRODUCT_BUNDLE_IDENTIFIER: com.osgkeyboard.ios.keyboard
TARGETED_DEVICE_FAMILY: "1,2"
SUPPORTS_MACCATALYST: NO
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD: NO
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD: NO
# TestFlight upload: Automatic signing picks the right App Store profile.
CODE_SIGN_STYLE: Automatic
DEVELOPMENT_TEAM: X329MZU23S
dependencies:
- target: OSGKeyboardShared
embed: false
# =========================================================
# Live Activity Widget Extension (Dynamic Island)
# =========================================================
OSGKeyboardLiveActivity:
type: app-extension
platform: iOS
sources:
- path: OSGKeyboardLiveActivity
info:
path: OSGKeyboardLiveActivity/Info.plist
properties:
CFBundleDisplayName: OSGKeyboardLiveActivity
CFBundleShortVersionString: "$(MARKETING_VERSION)"
CFBundleVersion: "$(CURRENT_PROJECT_VERSION)"
NSSupportsLiveActivities: true
NSExtension:
NSExtensionPointIdentifier: com.apple.widgetkit-extension
settings:
base:
PRODUCT_BUNDLE_IDENTIFIER: com.osgkeyboard.ios.liveactivity
TARGETED_DEVICE_FAMILY: "1,2"
SUPPORTS_MACCATALYST: NO
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD: NO
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD: NO
CODE_SIGN_STYLE: Automatic
DEVELOPMENT_TEAM: X329MZU23S
dependencies:
- sdk: WidgetKit.framework
- sdk: SwiftUI.framework
- sdk: ActivityKit.framework
# =========================================================
# Shared Framework (主 App 与扩展共用)
# =========================================================
OSGKeyboardShared:
type: framework
platform: iOS
sources:
- path: OSGKeyboardShared
excludes:
- "en.lproj"
- "zh-Hans.lproj"
- "**/*.swift.example"
- path: OSGKeyboardShared/en.lproj/Shared.strings
buildPhase: resources
- path: OSGKeyboardShared/zh-Hans.lproj/Shared.strings
buildPhase: resources
resources:
- path: OSGKeyboardShared/Resources/CustomLanguageModel/v1/OSGKeyboardCLM.bin
- path: OSGKeyboardShared/Resources/CustomLanguageModel/v1/compiled-manifest.json
- path: OSGKeyboardShared/Resources/LocalASR/local-asr-catalog.json
info:
path: OSGKeyboardShared/Info.plist
settings:
base:
PRODUCT_BUNDLE_IDENTIFIER: com.osgkeyboard.ios.shared
TARGETED_DEVICE_FAMILY: "1,2"
DEFINES_MODULE: YES
SKIP_INSTALL: YES
BUILD_LIBRARY_FOR_DISTRIBUTION: NO
DYLIB_INSTALL_NAME_BASE: "@rpath"
APPLICATION_EXTENSION_API_ONLY: YES
ENABLE_MODULE_VERIFIER: YES
# Embedded frameworks are re-signed by the containing app at package
# time. Signing this framework as a standalone build product is noisy
# and not recommended by Xcode.
CODE_SIGNING_ALLOWED: NO
CODE_SIGNING_REQUIRED: NO
CODE_SIGN_IDENTITY: ""
dependencies:
- sdk: Speech.framework
- sdk: AVFoundation.framework
- sdk: Charts.framework
- sdk: StoreKit.framework
# =========================================================
# 单元测试
# =========================================================
OSGKeyboardTests:
type: bundle.unit-test
platform: iOS
sources:
- path: OSGKeyboardTests
info:
path: OSGKeyboardTests/Info.plist
dependencies:
- target: OSGKeyboard
settings:
base:
PRODUCT_BUNDLE_IDENTIFIER: com.osgkeyboard.ios.tests
TARGETED_DEVICE_FAMILY: "1,2"
# =========================================================
# 键盘扩展单元测试 (TEST-4)
# =========================================================
OSGKeyboardExtTests:
type: bundle.unit-test
platform: iOS
sources:
- path: OSGKeyboardExtTests
info:
path: OSGKeyboardExtTests/Info.plist
dependencies:
- target: OSGKeyboardShared
settings:
base:
PRODUCT_BUNDLE_IDENTIFIER: com.osgkeyboard.ios.ext.tests
TARGETED_DEVICE_FAMILY: "1,2"
# =========================================================
# macOS 菜单栏 App (Phase 1 · 云端 MVP)
# =========================================================
# Standalone menu-bar utility: record → cloud ASR → polish → clipboard.
# Reuses the platform-agnostic core files from OSGKeyboardShared at the
# source level (no framework), excluding the iOS-only files that import
# SpeechAnalyzer / AVAudioSession / UIKit / SwiftUI views. Local mode uses
# Qwen3 MLX streaming via mlx-audio-swift plus catalog-managed weights.
OSGKeyboardMac:
type: application
platform: macOS
deploymentTarget: "15.0"
sources:
# Same Icon Composer asset as the iOS app — do not ship a separate PNG
# appiconset; actool crashes if both coexist.
- path: OSGKeyboard/AppIcon.icon
buildPhase: resources
# Reuse the iOS asset catalog for provider logos + brand mark. Exclude
# the PNG appiconset so it doesn't clash with AppIcon.icon above.
- path: OSGKeyboard/Assets.xcassets
excludes:
- "AppIcon.appiconset"
- path: OSGKeyboardMac
- path: OSGKeyboard/Services/OpenSourceLicenseCatalog.swift
- path: OSGKeyboardShared
excludes:
- "en.lproj"
- "zh-Hans.lproj"
- "Info.plist"
- "**/*.swift.example"
- "DesignSystem/WaveformView.swift"
- "DesignSystem/TranslationChip.swift"
- "DesignSystem/RecordButton.swift"
- "Services/ASRService.swift"
- "Services/CloudASR/CloudASRService.swift"
- "Services/FlowContinuousCapture.swift"
- "Services/LiveDictationController.swift"
- "Services/KeyboardState.swift"
- "Services/CursorNavigation.swift"
- "Models/MicVoiceAvailability+Keyboard.swift"
- "Utilities/ProgressiveDictationTranscriptAccumulator.swift"
- path: OSGKeyboardShared/en.lproj/Shared.strings
buildPhase: resources
- path: OSGKeyboardShared/zh-Hans.lproj/Shared.strings
buildPhase: resources
- path: OSGKeyboard/Resources/CustomLanguageModel/v1/phrases.tsv
buildPhase: resources
- path: OSGKeyboardShared/Resources/CustomLanguageModel/v1/OSGKeyboardCLM.bin
buildPhase: resources
- path: OSGKeyboardShared/Resources/CustomLanguageModel/v1/compiled-manifest.json
buildPhase: resources
- path: OSGKeyboard/Resources/PrivacyPolicy.html
buildPhase: resources
- path: OSGKeyboardShared/Resources/LocalASR/local-asr-catalog.json
buildPhase: resources
entitlements:
path: OSGKeyboardMac/OSGKeyboardMac.entitlements
properties:
# Sandbox disabled on purpose: this menu-bar dictation utility uses the
# Accessibility API to monitor a global hotkey and inject ⌘V into other
# apps — both are forbidden by App Sandbox. Ship via Developer ID +
# notarization (not Mac App Store / TestFlight, which force the sandbox).
com.apple.security.app-sandbox: false
com.apple.security.device.audio-input: true
com.apple.security.network.client: true
com.apple.developer.ubiquity-kvstore-identifier: $(TeamIdentifierPrefix)com.osgkeyboard.ios
keychain-access-groups:
- $(AppIdentifierPrefix)com.osgkeyboard.shared
info:
path: OSGKeyboardMac/Info.plist
properties:
CFBundleDisplayName: OSGKeyboard
CFBundleShortVersionString: "$(MARKETING_VERSION)"
CFBundleVersion: "$(CURRENT_PROJECT_VERSION)"
CFBundleDevelopmentRegion: en
CFBundleLocalizations:
- en
- zh-Hans
LSApplicationCategoryType: public.app-category.utilities
NSMicrophoneUsageDescription: "OSGKeyboard uses the microphone to transcribe your voice via your configured cloud speech provider."
NSSpeechRecognitionUsageDescription: "OSGKeyboard uses on-device speech recognition for local dictation mode."
NSHumanReadableCopyright: "OSGKeyboard"
ITSAppUsesNonExemptEncryption: false
CFBundleURLTypes:
- CFBundleURLName: com.osgkeyboard.mac.seed
CFBundleURLSchemes:
- osgkeyboard
settings:
base:
PRODUCT_NAME: OSGKeyboard
INFOPLIST_KEY_CFBundleDisplayName: OSGKeyboard
INFOPLIST_KEY_CFBundleName: OSGKeyboard
PRODUCT_BUNDLE_IDENTIFIER: com.osgkeyboard.mac
MACOSX_DEPLOYMENT_TARGET: "15.0"
ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon
# macOS app is not an app extension; override the framework-wide flag.
APPLICATION_EXTENSION_API_ONLY: NO
CODE_SIGN_STYLE: Automatic
DEVELOPMENT_TEAM: X329MZU23S
# Required for Developer ID distribution + notarization (outside App Store).
ENABLE_HARDENED_RUNTIME: YES
dependencies:
- package: MLXAudio
product: MLXAudioSTT
- sdk: Speech.framework
- sdk: AVFoundation.framework
- sdk: Charts.framework
- sdk: StoreKit.framework
schemes:
OSGKeyboard:
build:
targets:
OSGKeyboard: all
OSGKeyboardExt: all
OSGKeyboardLiveActivity: all
run:
config: Debug
storeKitConfiguration: OSGKeyboard.storekit
test:
config: Debug
targets:
- OSGKeyboardTests
- OSGKeyboardExtTests
archive:
config: Release
OSGKeyboardMac:
build:
targets:
OSGKeyboardMac: all
run:
config: Debug
archive:
config: Release