Skip to content

[Swift-example][Playground] [Swift-SDK] Introducing YapRun#400

Merged
sanchitmonga22 merged 38 commits intomainfrom
smonga/wispr_flow_clone
Feb 24, 2026
Merged

[Swift-example][Playground] [Swift-SDK] Introducing YapRun#400
sanchitmonga22 merged 38 commits intomainfrom
smonga/wispr_flow_clone

Conversation

@sanchitmonga22
Copy link
Copy Markdown
Contributor

@sanchitmonga22 sanchitmonga22 commented Feb 21, 2026

Description

Brief description of the changes made.

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactoring

Testing

  • Lint passes locally
  • Added/updated tests for changes

Platform-Specific Testing (check all that apply)

Swift SDK / iOS Sample:

  • Tested on iPhone (Simulator or Device)
  • Tested on iPad / Tablet
  • Tested on Mac (macOS target)

Kotlin SDK / Android Sample:

  • Tested on Android Phone (Emulator or Device)
  • Tested on Android Tablet

Flutter SDK / Flutter Sample:

  • Tested on iOS
  • Tested on Android

React Native SDK / React Native Sample:

  • Tested on iOS
  • Tested on Android

Playground:

  • Tested on target platform
  • Verified no regressions in existing Playground projects
    Web SDK / Web Sample:
  • Tested in Chrome (Desktop)
  • Tested in Firefox
  • Tested in Safari
  • WASM backends load (LlamaCpp + ONNX)
  • OPFS storage persistence verified (survives page refresh)
  • Settings persistence verified (localStorage)

Labels

Please add the appropriate label(s):

SDKs:

  • Swift SDK - Changes to Swift SDK (sdk/runanywhere-swift)
  • Kotlin SDK - Changes to Kotlin SDK (sdk/runanywhere-kotlin)
  • Flutter SDK - Changes to Flutter SDK (sdk/runanywhere-flutter)
  • React Native SDK - Changes to React Native SDK (sdk/runanywhere-react-native)
  • Web SDK - Changes to Web SDK (sdk/runanywhere-web)
  • Commons - Changes to shared native code (sdk/runanywhere-commons)

Sample Apps:

  • iOS Sample - Changes to iOS example app (examples/ios)
  • Android Sample - Changes to Android example app (examples/android)
  • Flutter Sample - Changes to Flutter example app (examples/flutter)
  • React Native Sample - Changes to React Native example app (examples/react-native)
  • Web Sample - Changes to Web example app (examples/web)

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed)

Screenshots

Attach relevant UI screenshots for changes (if applicable):

  • Mobile (Phone)
  • Tablet / iPad
  • Desktop / Mac

Greptile Summary

This PR introduces YapRun - a new on-device voice dictation playground app built on the RunAnywhere SDK. It demonstrates production-ready voice-to-text capabilities across iOS and macOS platforms with a Wispr Flow-inspired architecture.

Key Changes

New Playground Application

  • Complete iOS/macOS dual-target app (Playground/YapRun/) with 60+ new Swift files
  • iOS: Custom keyboard extension with Live Activity support for background dictation
  • macOS: Agent app with global Fn hotkey, Flow Bar overlay, and menu bar integration
  • Shared codebase maximizes code reuse between platforms via compiler directives

WhisperKit CoreML Integration

  • New WhisperKitRuntime module for Apple Neural Engine STT acceleration
  • C++/Swift bridge via callback vtable pattern (rac_stt_whisperkit_coreml.h)
  • Supports both WhisperKit CoreML (Neural Engine) and ONNX Runtime (CPU) backends
  • Platform-specific model defaults: tiny.en for iOS (battery-friendly), base.en for macOS (accuracy)

Architecture Highlights

  • iOS Flow Session: Deep link from keyboard → main app starts audio engine while foregrounded → Live Activity keeps process alive → background transcription → result delivery via Darwin notifications + App Group UserDefaults
  • macOS Push-to-Talk: Global CGEvent tap monitors Fn key → starts recording → releases key → transcribes on-device → inserts text via simulated Cmd+V
  • Clean separation: UI layer (SwiftUI) → Session/Service layer (async/await) → SDK layer (C++ bridge actors) → C++ STT component

Issues Found

Critical

  • Struct field mismatch in rac_model_types.h between Swift SDK copy and C++ source - url/filename vs relative_path/destination_path will cause memory corruption

Known (Already Flagged)

  • MainActor.assumeIsolated usage in audio callbacks (needs verification that callbacks are main-dispatched)
  • DispatchSemaphore.wait() blocking in WhisperKit callbacks (Swift 6 violation but unavoidable for C interop)
  • exit(0) usage on deep link (bypasses cleanup)

Confidence Score: 3/5

  • Safe to merge with one critical fix (struct definition sync) and awareness of threading edge cases
  • The architecture is well-designed and the codebase is production-quality, but the struct field mismatch in rac_model_types.h is a critical memory safety issue that must be fixed before merge. The other flagged issues (semaphores, MainActor.assumeIsolated, exit) were already discussed in previous reviews and represent known trade-offs or require verification rather than immediate fixes.
  • sdk/runanywhere-swift/Sources/RunAnywhere/CRACommons/include/rac_model_types.h requires immediate sync with C++ source to fix struct definition mismatch

Important Files Changed

Filename Overview
sdk/runanywhere-swift/Sources/RunAnywhere/CRACommons/include/rac_model_types.h C header copy has struct field mismatch with source - will cause memory corruption
Playground/YapRun/YapRun/YapRunApp.swift Main app entry point - well-structured iOS/macOS dual target with SDK initialization
Playground/YapRun/YapRun/Features/VoiceKeyboard/FlowSessionManager.swift iOS Flow session manages background audio + Live Activity for keyboard dictation
Playground/YapRun/YapRun/macOS/Services/MacDictationService.swift macOS dictation orchestrator - hotkey-driven push-to-talk with auto model loading
sdk/runanywhere-swift/Sources/WhisperKitRuntime/WhisperKitSTT.swift WhisperKit CoreML module registration - uses blocking semaphores (known issue)
Playground/YapRun/YapRunKeyboard/KeyboardViewController.swift Custom keyboard extension triggers main app via deep link, handles transcription insertion

Last reviewed commit: 89a0a6f

- Enabled local binaries for development in Package.swift.
- Added VoiceDictationManagementView and ViewModel for managing dictation settings and history.
- Introduced FlowSessionManager to handle audio recording and transcription flow.
- Created shared constants and data bridge for inter-process communication between the main app and keyboard extension.
- Updated Info.plist for keyboard extension with necessary permissions and configurations.
- Integrated deep linking to start dictation sessions from the keyboard.

This commit lays the groundwork for a fully functional voice dictation feature in the RunAnywhereAI iOS app.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 21, 2026

Important

Review skipped

Too many files!

This PR contains 162 files, which is 12 over the limit of 150.

📥 Commits

Reviewing files that changed from the base of the PR and between 4d1ff04 and ddc4a3e.

⛔ Files ignored due to path filters (30)
  • Playground/YapRun/YapRun/Assets.xcassets/AppIcon.appiconset/AppIcon-dark.png is excluded by !**/*.png
  • Playground/YapRun/YapRun/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-1024.png is excluded by !**/*.png
  • Playground/YapRun/YapRun/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-128.png is excluded by !**/*.png
  • Playground/YapRun/YapRun/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-16.png is excluded by !**/*.png
  • Playground/YapRun/YapRun/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-256.png is excluded by !**/*.png
  • Playground/YapRun/YapRun/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-32.png is excluded by !**/*.png
  • Playground/YapRun/YapRun/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-512.png is excluded by !**/*.png
  • Playground/YapRun/YapRun/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-64.png is excluded by !**/*.png
  • Playground/YapRun/YapRun/Assets.xcassets/AppIcon.appiconset/AppIcon-tinted.png is excluded by !**/*.png
  • Playground/YapRun/YapRun/Assets.xcassets/AppIcon.appiconset/AppIcon.png is excluded by !**/*.png
  • Playground/YapRun/YapRun/Assets.xcassets/runanywhere_logo.imageset/runanywhere_logo@1x.png is excluded by !**/*.png
  • Playground/YapRun/YapRun/Assets.xcassets/runanywhere_logo.imageset/runanywhere_logo@2x.png is excluded by !**/*.png
  • Playground/YapRun/YapRun/Assets.xcassets/runanywhere_logo.imageset/runanywhere_logo@3x.png is excluded by !**/*.png
  • Playground/YapRun/YapRun/Assets.xcassets/yaprun_logo.imageset/yaprun_logo.png is excluded by !**/*.png
  • Playground/YapRun/YapRunActivity/Assets.xcassets/AppIcon.appiconset/AppIcon-dark.png is excluded by !**/*.png
  • Playground/YapRun/YapRunActivity/Assets.xcassets/AppIcon.appiconset/AppIcon-tinted.png is excluded by !**/*.png
  • Playground/YapRun/YapRunActivity/Assets.xcassets/AppIcon.appiconset/AppIcon.png is excluded by !**/*.png
  • Playground/YapRun/YapRunActivity/Assets.xcassets/yaprun_icon.imageset/runanywhere_icon@1x.png is excluded by !**/*.png
  • Playground/YapRun/YapRunActivity/Assets.xcassets/yaprun_icon.imageset/runanywhere_icon@2x.png is excluded by !**/*.png
  • Playground/YapRun/YapRunActivity/Assets.xcassets/yaprun_icon.imageset/runanywhere_icon@3x.png is excluded by !**/*.png
  • Playground/YapRun/YapRunKeyboard/Assets.xcassets/yaprun_icon.imageset/icon@1x.png is excluded by !**/*.png
  • Playground/YapRun/YapRunKeyboard/Assets.xcassets/yaprun_icon.imageset/icon@2x.png is excluded by !**/*.png
  • Playground/YapRun/YapRunKeyboard/Assets.xcassets/yaprun_icon.imageset/icon@3x.png is excluded by !**/*.png
  • Playground/YapRun/logos/logo9-wave-keys.svg is excluded by !**/*.svg
  • examples/ios/RunAnywhereAI/RunAnywhereActivityExtension/Assets.xcassets/runanywhere_icon.imageset/runanywhere_icon@1x.png is excluded by !**/*.png
  • examples/ios/RunAnywhereAI/RunAnywhereActivityExtension/Assets.xcassets/runanywhere_icon.imageset/runanywhere_icon@2x.png is excluded by !**/*.png
  • examples/ios/RunAnywhereAI/RunAnywhereActivityExtension/Assets.xcassets/runanywhere_icon.imageset/runanywhere_icon@3x.png is excluded by !**/*.png
  • examples/ios/RunAnywhereAI/RunAnywhereKeyboard/Assets.xcassets/runanywhere_icon.imageset/icon@1x.png is excluded by !**/*.png
  • examples/ios/RunAnywhereAI/RunAnywhereKeyboard/Assets.xcassets/runanywhere_icon.imageset/icon@2x.png is excluded by !**/*.png
  • examples/ios/RunAnywhereAI/RunAnywhereKeyboard/Assets.xcassets/runanywhere_icon.imageset/icon@3x.png is excluded by !**/*.png
📒 Files selected for processing (162)
  • .gitignore
  • Package.resolved
  • Package.swift
  • Playground/YapRun/YapRun.xcodeproj/project.pbxproj
  • Playground/YapRun/YapRun.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  • Playground/YapRun/YapRun.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
  • Playground/YapRun/YapRun/Assets.xcassets/AccentColor.colorset/Contents.json
  • Playground/YapRun/YapRun/Assets.xcassets/AppIcon.appiconset/Contents.json
  • Playground/YapRun/YapRun/Assets.xcassets/Contents.json
  • Playground/YapRun/YapRun/Assets.xcassets/runanywhere_logo.imageset/Contents.json
  • Playground/YapRun/YapRun/Assets.xcassets/yaprun_logo.imageset/Contents.json
  • Playground/YapRun/YapRun/ContentView.swift
  • Playground/YapRun/YapRun/Core/AppColors.swift
  • Playground/YapRun/YapRun/Core/AppTypes.swift
  • Playground/YapRun/YapRun/Core/ClipboardService.swift
  • Playground/YapRun/YapRun/Core/DictationHistory.swift
  • Playground/YapRun/YapRun/Core/ModelRegistry.swift
  • Playground/YapRun/YapRun/Features/Home/AddModelURLSheet.swift
  • Playground/YapRun/YapRun/Features/Home/HomeViewModel.swift
  • Playground/YapRun/YapRun/Features/Home/ModelCardView.swift
  • Playground/YapRun/YapRun/Features/Notepad/NotepadView.swift
  • Playground/YapRun/YapRun/Features/Onboarding/OnboardingView.swift
  • Playground/YapRun/YapRun/Features/Onboarding/OnboardingViewModel.swift
  • Playground/YapRun/YapRun/Features/Onboarding/Steps/KeyboardSetupStepView.swift
  • Playground/YapRun/YapRun/Features/Onboarding/Steps/MicPermissionStepView.swift
  • Playground/YapRun/YapRun/Features/Onboarding/Steps/ModelDownloadStepView.swift
  • Playground/YapRun/YapRun/Features/Onboarding/Steps/WelcomeStepView.swift
  • Playground/YapRun/YapRun/Features/Playground/PlaygroundView.swift
  • Playground/YapRun/YapRun/Features/Playground/PlaygroundViewModel.swift
  • Playground/YapRun/YapRun/Features/VoiceKeyboard/DictationActivityAttributes.swift
  • Playground/YapRun/YapRun/Features/VoiceKeyboard/FlowActivationView.swift
  • Playground/YapRun/YapRun/Features/VoiceKeyboard/FlowSessionManager.swift
  • Playground/YapRun/YapRun/Info.plist
  • Playground/YapRun/YapRun/Settings.bundle/Root.plist
  • Playground/YapRun/YapRun/Shared/SharedConstants.swift
  • Playground/YapRun/YapRun/Shared/SharedDataBridge.swift
  • Playground/YapRun/YapRun/YapRun.entitlements
  • Playground/YapRun/YapRun/YapRunApp.swift
  • Playground/YapRun/YapRun/macOS/Features/FlowBarView.swift
  • Playground/YapRun/YapRun/macOS/Features/FlowBarWindow.swift
  • Playground/YapRun/YapRun/macOS/Features/MacHomeView.swift
  • Playground/YapRun/YapRun/macOS/Features/MacHubView.swift
  • Playground/YapRun/YapRun/macOS/Features/MacNotepadView.swift
  • Playground/YapRun/YapRun/macOS/Features/MacPlaygroundView.swift
  • Playground/YapRun/YapRun/macOS/Features/MacSettingsView.swift
  • Playground/YapRun/YapRun/macOS/Features/MenuBarManager.swift
  • Playground/YapRun/YapRun/macOS/Features/Onboarding/AccessibilityStepView.swift
  • Playground/YapRun/YapRun/macOS/Features/Onboarding/MacMicPermissionStepView.swift
  • Playground/YapRun/YapRun/macOS/Features/Onboarding/MacModelDownloadStepView.swift
  • Playground/YapRun/YapRun/macOS/Features/Onboarding/MacOnboardingView.swift
  • Playground/YapRun/YapRun/macOS/Features/Onboarding/MacOnboardingViewModel.swift
  • Playground/YapRun/YapRun/macOS/Features/Onboarding/MacWelcomeStepView.swift
  • Playground/YapRun/YapRun/macOS/MacAppDelegate.swift
  • Playground/YapRun/YapRun/macOS/Services/MacAudioFeedbackService.swift
  • Playground/YapRun/YapRun/macOS/Services/MacDictationService.swift
  • Playground/YapRun/YapRun/macOS/Services/MacHotkeyService.swift
  • Playground/YapRun/YapRun/macOS/Services/MacPermissionService.swift
  • Playground/YapRun/YapRun/macOS/Services/MacTextInsertionService.swift
  • Playground/YapRun/YapRunActivity/Assets.xcassets/AccentColor.colorset/Contents.json
  • Playground/YapRun/YapRunActivity/Assets.xcassets/AppIcon.appiconset/Contents.json
  • Playground/YapRun/YapRunActivity/Assets.xcassets/Contents.json
  • Playground/YapRun/YapRunActivity/Assets.xcassets/WidgetBackground.colorset/Contents.json
  • Playground/YapRun/YapRunActivity/Assets.xcassets/yaprun_icon.imageset/Contents.json
  • Playground/YapRun/YapRunActivity/DictationActivityAttributes.swift
  • Playground/YapRun/YapRunActivity/Info.plist
  • Playground/YapRun/YapRunActivity/YapRunActivityBundle.swift
  • Playground/YapRun/YapRunActivity/YapRunActivityLiveActivity.swift
  • Playground/YapRun/YapRunActivityExtension.entitlements
  • Playground/YapRun/YapRunKeyboard/Assets.xcassets/Contents.json
  • Playground/YapRun/YapRunKeyboard/Assets.xcassets/yaprun_icon.imageset/Contents.json
  • Playground/YapRun/YapRunKeyboard/Info.plist
  • Playground/YapRun/YapRunKeyboard/KeyboardView.swift
  • Playground/YapRun/YapRunKeyboard/KeyboardViewController.swift
  • Playground/YapRun/YapRunKeyboard/SharedConstants.swift
  • Playground/YapRun/YapRunKeyboard/SharedDataBridge.swift
  • Playground/YapRun/YapRunKeyboard/YapRunKeyboard.entitlements
  • Playground/YapRun/YapRunTests/YapRunTests.swift
  • Playground/YapRun/YapRunUITests/YapRunUITests.swift
  • Playground/YapRun/YapRunUITests/YapRunUITestsLaunchTests.swift
  • Playground/YapRun/mac_plan.md
  • examples/ios/RunAnywhereAI/Package.resolved
  • examples/ios/RunAnywhereAI/Package.swift
  • examples/ios/RunAnywhereAI/RunAnywhereAI.xcodeproj/project.pbxproj
  • examples/ios/RunAnywhereAI/RunAnywhereAI.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
  • examples/ios/RunAnywhereAI/RunAnywhereAI/App/ContentView.swift
  • examples/ios/RunAnywhereAI/RunAnywhereAI/App/RunAnywhereAIApp.swift
  • examples/ios/RunAnywhereAI/RunAnywhereAI/Assets.xcassets/AccentColor.colorset/Contents.json
  • examples/ios/RunAnywhereAI/RunAnywhereAI/Features/VoiceKeyboard/DictationActivityAttributes.swift
  • examples/ios/RunAnywhereAI/RunAnywhereAI/Features/VoiceKeyboard/FlowActivationView.swift
  • examples/ios/RunAnywhereAI/RunAnywhereAI/Features/VoiceKeyboard/FlowSessionManager.swift
  • examples/ios/RunAnywhereAI/RunAnywhereAI/Features/VoiceKeyboard/VoiceDictationManagementView.swift
  • examples/ios/RunAnywhereAI/RunAnywhereAI/Features/VoiceKeyboard/VoiceDictationManagementViewModel.swift
  • examples/ios/RunAnywhereAI/RunAnywhereAI/Info.plist
  • examples/ios/RunAnywhereAI/RunAnywhereAI/RunAnywhereAI.entitlements
  • examples/ios/RunAnywhereAI/RunAnywhereAI/Shared/SharedConstants.swift
  • examples/ios/RunAnywhereAI/RunAnywhereAI/Shared/SharedDataBridge.swift
  • examples/ios/RunAnywhereAI/RunAnywhereActivityExtension/Assets.xcassets/AccentColor.colorset/Contents.json
  • examples/ios/RunAnywhereAI/RunAnywhereActivityExtension/Assets.xcassets/AppIcon.appiconset/Contents.json
  • examples/ios/RunAnywhereAI/RunAnywhereActivityExtension/Assets.xcassets/Contents.json
  • examples/ios/RunAnywhereAI/RunAnywhereActivityExtension/Assets.xcassets/WidgetBackground.colorset/Contents.json
  • examples/ios/RunAnywhereAI/RunAnywhereActivityExtension/Assets.xcassets/runanywhere_icon.imageset/Contents.json
  • examples/ios/RunAnywhereAI/RunAnywhereActivityExtension/Info.plist
  • examples/ios/RunAnywhereAI/RunAnywhereActivityExtension/RunAnywhereActivityExtensionBundle.swift
  • examples/ios/RunAnywhereAI/RunAnywhereActivityExtension/RunAnywhereActivityExtensionLiveActivity.swift
  • examples/ios/RunAnywhereAI/RunAnywhereKeyboard/Assets.xcassets/Contents.json
  • examples/ios/RunAnywhereAI/RunAnywhereKeyboard/Assets.xcassets/runanywhere_icon.imageset/Contents.json
  • examples/ios/RunAnywhereAI/RunAnywhereKeyboard/Info.plist
  • examples/ios/RunAnywhereAI/RunAnywhereKeyboard/KeyboardView.swift
  • examples/ios/RunAnywhereAI/RunAnywhereKeyboard/KeyboardViewController.swift
  • examples/ios/RunAnywhereAI/RunAnywhereKeyboard/RunAnywhereKeyboard.entitlements
  • sdk/runanywhere-commons/CMakeLists.txt
  • sdk/runanywhere-commons/cmake/FetchONNXRuntime.cmake
  • sdk/runanywhere-commons/include/rac/backends/rac_stt_whisperkit_coreml.h
  • sdk/runanywhere-commons/include/rac/infrastructure/model_management/rac_model_types.h
  • sdk/runanywhere-commons/scripts/build-ios.sh
  • sdk/runanywhere-commons/src/backends/onnx/CMakeLists.txt
  • sdk/runanywhere-commons/src/backends/onnx/rac_backend_onnx_register.cpp
  • sdk/runanywhere-commons/src/backends/whisperkit_coreml/CMakeLists.txt
  • sdk/runanywhere-commons/src/backends/whisperkit_coreml/rac_backend_whisperkit_coreml_register.cpp
  • sdk/runanywhere-commons/src/backends/whisperkit_coreml/rac_stt_whisperkit_coreml.cpp
  • sdk/runanywhere-commons/src/features/stt/rac_stt_service.cpp
  • sdk/runanywhere-commons/src/features/stt/stt_component.cpp
  • sdk/runanywhere-commons/src/infrastructure/model_management/model_paths.cpp
  • sdk/runanywhere-commons/src/infrastructure/model_management/model_registry.cpp
  • sdk/runanywhere-commons/src/infrastructure/model_management/model_types.cpp
  • sdk/runanywhere-commons/src/infrastructure/telemetry/telemetry_manager.cpp
  • sdk/runanywhere-commons/tests/CMakeLists.txt
  • sdk/runanywhere-commons/tests/Dockerfile.linux-tests
  • sdk/runanywhere-commons/tests/scripts/download-test-models.sh
  • sdk/runanywhere-commons/tests/scripts/run-tests-all.sh
  • sdk/runanywhere-commons/tests/scripts/run-tests-android.sh
  • sdk/runanywhere-commons/tests/scripts/run-tests-ios.sh
  • sdk/runanywhere-commons/tests/scripts/run-tests-linux.sh
  • sdk/runanywhere-commons/tests/scripts/run-tests-web.sh
  • sdk/runanywhere-commons/tests/scripts/run-tests.sh
  • sdk/runanywhere-commons/tests/test_common.h
  • sdk/runanywhere-commons/tests/test_config.h
  • sdk/runanywhere-commons/tests/test_core.cpp
  • sdk/runanywhere-commons/tests/test_llm.cpp
  • sdk/runanywhere-commons/tests/test_stt.cpp
  • sdk/runanywhere-commons/tests/test_tts.cpp
  • sdk/runanywhere-commons/tests/test_vad.cpp
  • sdk/runanywhere-commons/tests/test_voice_agent.cpp
  • sdk/runanywhere-commons/tests/test_wakeword.cpp
  • sdk/runanywhere-flutter/packages/runanywhere/lib/native/dart_bridge_stt.dart
  • sdk/runanywhere-flutter/packages/runanywhere/lib/native/native_backend.dart
  • sdk/runanywhere-swift/Sources/RunAnywhere/CRACommons/include/CRACommons.h
  • sdk/runanywhere-swift/Sources/RunAnywhere/CRACommons/include/rac_model_types.h
  • sdk/runanywhere-swift/Sources/RunAnywhere/CRACommons/include/rac_stt_whisperkit_coreml.h
  • sdk/runanywhere-swift/Sources/RunAnywhere/CRACommons/shim.c
  • sdk/runanywhere-swift/Sources/RunAnywhere/Features/STT/Services/AudioCaptureManager.swift
  • sdk/runanywhere-swift/Sources/RunAnywhere/Foundation/Bridge/Extensions/CppBridge+STT.swift
  • sdk/runanywhere-swift/Sources/RunAnywhere/Foundation/Bridge/Extensions/ModelTypes+CppBridge.swift
  • sdk/runanywhere-swift/Sources/RunAnywhere/Public/Extensions/Models/ModelTypes.swift
  • sdk/runanywhere-swift/Sources/RunAnywhere/Public/Extensions/Models/RunAnywhere+ModelAssignments.swift
  • sdk/runanywhere-swift/Sources/RunAnywhere/Public/Extensions/Models/RunAnywhere+ModelManagement.swift
  • sdk/runanywhere-swift/Sources/RunAnywhere/Public/Extensions/STT/RunAnywhere+STT.swift
  • sdk/runanywhere-swift/Sources/WhisperKitRuntime/WhisperKitSTT.swift
  • sdk/runanywhere-swift/Sources/WhisperKitRuntime/WhisperKitSTTService.swift
  • sdk/runanywhere-swift/VERSION
  • sdk/runanywhere-swift/scripts/build-swift.sh
  • sdk/runanywhere-swift/scripts/create-onnxruntime-xcframework.sh

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch smonga/wispr_flow_clone

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sanchitmonga22 sanchitmonga22 changed the title [Playground] Introducing YapRun [Swift-example][Playground] Introducing YapRun Feb 21, 2026
sanchitmonga22 and others added 10 commits February 21, 2026 10:22
- Removed hardcoded color schemes in multiple views, replacing them with adaptive colors from AppColors.
- Updated ContentView, ModelCardView, NotepadView, and various onboarding steps to use AppColors for text and background styles.
- Added a new AppTab enum for managing tab selection in the iOS app.
- Introduced a new network client entitlement in the app's entitlements file.
- Ensured that the app respects the system's light/dark mode settings across various views.
- Added WhisperKit as a new library for speech-to-text processing using Apple Neural Engine.
- Introduced WhisperKitRuntime target and integrated it into the main application.
- Updated ModelRegistry to include WhisperKit models and their respective handling.
- Enhanced RunAnywhere SDK to support model registration and discovery for WhisperKit.
- Updated various components to utilize WhisperKit for STT, ensuring compatibility with existing frameworks.
- Refactored model management to accommodate WhisperKit's directory-based model structure.
- Added RunAnywhereWhisperKit SPM product for Apple Neural Engine STT
- Changed WhisperKit dependency from local path to remote URL for SPM consumers
- Fixed model download persistence: added RAC_FRAMEWORK_WHISPERKIT to discovery scan
- Fixed registerModel() race condition with flushPendingRegistrations()
- Emitted Swift STT events for WhisperKit model load/unload
- Updated checksums for v0.19.2 xcframeworks (iOS + macOS)

Co-authored-by: Cursor <cursoragent@cursor.com>
sanchitmonga22 and others added 8 commits February 22, 2026 15:48
- Fixed framework_to_string() in telemetry to serialize whisperkit_coreml, coreml, mlx
- Fixed STT component to configure actual_framework before model load
- Pass framework from ModelInfo through CppBridge.STT.loadModel()
- Updated checksums for v0.19.3 xcframeworks (iOS + macOS)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Added CFBundleVersion to build-ios.sh Info.plist templates (RACommons, backends)
- Added CFBundleVersion + CFBundleShortVersionString to onnxruntime macOS plist in create-onnxruntime-xcframework.sh
- Added MinimumOSVersion to pre-built onnxruntime iOS Info.plists
- Updated Package.swift version to 0.19.4 with new checksums
- Updated sdk/runanywhere-swift/VERSION to 0.19.4

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rameworks

- Restructure xcframeworks from .framework format to plain .a library format
  to prevent SPM/Xcode from embedding static libraries as dynamic frameworks
- Split onnxruntime into iOS (static) and macOS (dynamic) xcframeworks since
  xcframeworks can't mix library types
- Make all library products explicitly .static in Package.swift
- Add build phase to strip SPM-generated framework stubs from app bundle
- Update build-ios.sh and create-onnxruntime-xcframework.sh to produce
  library-format xcframeworks going forward

This fixes: "Invalid Bundle - does not support minimum OS Version" and
"Upload Symbols Failed" errors during App Store validation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
sanchitmonga22 and others added 5 commits February 23, 2026 00:38
[Swift-SDK] [Swift-Example] Whisper kit integration
… errors

type: .static on SPM library products prevents binary target linker flags
from being forwarded to consuming apps, causing "Undefined symbol: _rac_*"
errors when archiving. Reverting to automatic library type resolves this.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Library-format xcframeworks (.a files) cause linker errors when consumed
by Xcode apps via remote SPM. Reverted release zips to framework-format
(.framework bundles) which properly propagate linker flags.

Local dev still uses library-format via useLocalBinaries=true.
The YapRun strip build phase handles App Store embedding.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolved 7 merge conflicts:
- Package.swift: Keep WhisperKit product + ragProducts() + split ONNX binaries
- RunAnywhereAIApp.swift: Keep both WhisperKit + RAG embedding models
- CMakeLists.txt: Add RAG backend build + combined backend summary
- build-ios.sh: Keep library format xcframeworks + macOS slices
- tests/CMakeLists.txt: Combine integration tests + RAG GoogleTests
- AudioCaptureManager.swift: Keep Bluetooth workaround + ceil() fix
- RunAnywhere+ModelManagement.swift: Keep framework param for STT loading

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sanchitmonga22 sanchitmonga22 changed the title [Swift-example][Playground] Introducing YapRun [Swift-example][Playground] [Swift-SDK] Introducing YapRun Feb 23, 2026
@sanchitmonga22 sanchitmonga22 marked this pull request as ready for review February 23, 2026 20:22
@sanchitmonga22
Copy link
Copy Markdown
Contributor Author

@greptile please review

@sanchitmonga22
Copy link
Copy Markdown
Contributor Author

@coderabbitai please review

@ellipsis-dev
Copy link
Copy Markdown

ellipsis-dev bot commented Feb 23, 2026

⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at help@ellipsis.dev


Generated with ❤️ by ellipsis.dev

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 23, 2026

@sanchitmonga22: I'll review the changes in this PR now.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

191 files reviewed, 7 comments

Edit Code Review Agent Settings | Greptile

logger.info("Received kill deep link — killing session and terminating")
Task {
await flowSession.killSession()
exit(0)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exit(0) bypasses normal cleanup and can leave resources in inconsistent state. Consider using a graceful shutdown pattern instead.

Suggested change
exit(0)
await flowSession.killSession()
// Allow the system to handle app termination gracefully
Prompt To Fix With AI
This is a comment left during a code review.
Path: Playground/YapRun/YapRun/YapRunApp.swift
Line: 112

Comment:
`exit(0)` bypasses normal cleanup and can leave resources in inconsistent state. Consider using a graceful shutdown pattern instead.

```suggestion
                    await flowSession.killSession()
                    // Allow the system to handle app termination gracefully
```

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +144 to +158
let semaphore = DispatchSemaphore(value: 0)

Task {
do {
try await WhisperKitSTTService.shared.loadModel(modelId: id, modelFolder: path)
handle = Unmanaged.passRetained(WhisperKitSTTService.shared).toOpaque()
} catch {
let logger = SDKLogger(category: "WhisperKitCoreML")
logger.error("Failed to load WhisperKit CoreML model: \(error)")
handle = nil
}
semaphore.signal()
}

semaphore.wait()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using DispatchSemaphore.wait() blocks the calling thread until the async task completes. This can cause thread pool exhaustion if called from a cooperative thread (like Swift concurrency runtime threads) and violates Swift 6 strict concurrency rules. Consider restructuring to use async/await throughout the call chain.

Prompt To Fix With AI
This is a comment left during a code review.
Path: sdk/runanywhere-swift/Sources/WhisperKitRuntime/WhisperKitSTT.swift
Line: 144-158

Comment:
Using `DispatchSemaphore.wait()` blocks the calling thread until the async task completes. This can cause thread pool exhaustion if called from a cooperative thread (like Swift concurrency runtime threads) and violates Swift 6 strict concurrency rules. Consider restructuring to use async/await throughout the call chain.

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +184 to +206
let semaphore = DispatchSemaphore(value: 0)

Task {
do {
let service = Unmanaged<WhisperKitSTTService>.fromOpaque(handle).takeUnretainedValue()
let output = try await service.transcribe(data, options: sttOptions)

outResult.pointee.text = output.text.isEmpty ? nil : strdup(output.text)
outResult.pointee.confidence = output.confidence
outResult.pointee.processing_time_ms = Int64(output.metadata.processingTime * 1000)

if let lang = output.detectedLanguage {
outResult.pointee.detected_language = strdup(lang)
}

result = RAC_SUCCESS
} catch {
let logger = SDKLogger(category: "WhisperKitCoreML")
logger.error("WhisperKit CoreML transcribe failed: \(error)")
result = RAC_ERROR_INTERNAL
}
semaphore.signal()
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same DispatchSemaphore blocking pattern here. Since this is called from C++ callbacks that need synchronous responses, the blocking is unavoidable, but be aware this violates Swift 6 concurrency guarantees and can cause deadlocks if called on @MainActor contexts.

Prompt To Fix With AI
This is a comment left during a code review.
Path: sdk/runanywhere-swift/Sources/WhisperKitRuntime/WhisperKitSTT.swift
Line: 184-206

Comment:
Same `DispatchSemaphore` blocking pattern here. Since this is called from C++ callbacks that need synchronous responses, the blocking is unavoidable, but be aware this violates Swift 6 concurrency guarantees and can cause deadlocks if called on `@MainActor` contexts.

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +162 to +167
MainActor.assumeIsolated {
guard let self else { return }
SharedDataBridge.shared.audioLevel = self.audioCapture.audioLevel
guard case .listening = self.sessionPhase else { return }
self.audioBuffer.append(data)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MainActor.assumeIsolated is unsafe if the callback isn't actually on the main thread. AVAudioEngine's tap callback runs on a real-time audio thread. Check if audioCapture.startRecording's callback is guaranteed to dispatch to main queue, otherwise this will crash.

Prompt To Fix With AI
This is a comment left during a code review.
Path: Playground/YapRun/YapRun/Features/VoiceKeyboard/FlowSessionManager.swift
Line: 162-167

Comment:
`MainActor.assumeIsolated` is unsafe if the callback isn't actually on the main thread. AVAudioEngine's tap callback runs on a real-time audio thread. Check if `audioCapture.startRecording`'s callback is guaranteed to dispatch to main queue, otherwise this will crash.

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +169 to +174
MainActor.assumeIsolated {
guard let self else { return }
self.audioBuffer.append(data)
self.audioLevel = self.audioCapture.audioLevel
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same MainActor.assumeIsolated concern - verify the audio callback actually runs on main queue

Prompt To Fix With AI
This is a comment left during a code review.
Path: Playground/YapRun/YapRun/macOS/Services/MacDictationService.swift
Line: 169-174

Comment:
Same `MainActor.assumeIsolated` concern - verify the audio callback actually runs on main queue

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +180 to +185
MainActor.assumeIsolated {
guard let self else { return }
// Always update audio level for waveform display
SharedDataBridge.shared.audioLevel = self.audioCapture.audioLevel
// Only accumulate audio data during the explicit listening window
guard case .listening = self.sessionPhase else { return }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same MainActor.assumeIsolated concern - verify the audio callback actually runs on main queue

Prompt To Fix With AI
This is a comment left during a code review.
Path: examples/ios/RunAnywhereAI/RunAnywhereAI/Features/VoiceKeyboard/FlowSessionManager.swift
Line: 180-185

Comment:
Same `MainActor.assumeIsolated` concern - verify the audio callback actually runs on main queue

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +74 to +77
MainActor.assumeIsolated {
guard let self else { return }
self.audioBuffer.append(data)
self.audioLevel = self.audioCapture.audioLevel
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same MainActor.assumeIsolated concern - verify the audio callback actually runs on main queue

Prompt To Fix With AI
This is a comment left during a code review.
Path: Playground/YapRun/YapRun/Features/Playground/PlaygroundViewModel.swift
Line: 74-77

Comment:
Same `MainActor.assumeIsolated` concern - verify the audio callback actually runs on main queue

How can I resolve this? If you propose a fix, please make it concise.

sanchitmonga22 and others added 8 commits February 23, 2026 13:04
macOS frameworks require Versions/A/ directory structure with symlinks.
The flat iOS-style structure caused linker errors on macOS builds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Framework-format xcframeworks for proper SPM linker flag propagation
- Versioned macOS framework structure (Versions/A/ with symlinks)
- Flat iOS framework structure (standard)
- Fixes undefined symbol errors on both iOS and macOS remote SPM builds

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace stale "ONNXRuntimeBinary" dependency (which doesn't exist) with
platform-conditional ONNXRuntimeiOSBinary/ONNXRuntimemacOSBinary targets.
This was preventing SPM from resolving the package graph.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The LoRA functions (rac_llm_component_*_lora) are declared in headers
but not yet implemented in the RACommons C++ library. The RAG functions
(rac_rag_*) are implemented in RABackendRAG which is excluded from
remote releases. Both cause undefined symbol linker errors.

Add weak stub implementations in shim.c that return
RAC_ERROR_NOT_IMPLEMENTED. When the real backends are available, the
strong definitions will override these stubs automatically.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add weak stubs for rac_voice_agent_* and
  rac_whisperkit_coreml_stt_set_callbacks (not yet in RACommons binary)
- Add ARCHS=arm64 to YapRun (xcframeworks are arm64-only)
- Fix OTHER_LDFLAGS to use $(inherited) + -all_load array format
  (required to force-link all symbols from SPM binary targets)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sanchitmonga22
Copy link
Copy Markdown
Contributor Author

@greptile please review

@sanchitmonga22
Copy link
Copy Markdown
Contributor Author

@coderabbitai please review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 24, 2026

@sanchitmonga22: I'll review the changes in this PR now.


🧠 Learnings used
Learnt from: CR
Repo: RunanywhereAI/runanywhere-sdks PR: 0
File: sdk/runanywhere-commons/CLAUDE.md:0-0
Timestamp: 2026-01-16T07:01:03.349Z
Learning: Applies to sdk/runanywhere-commons/src/backends/platform/*.{cpp,h} : Platform backend for Apple must use Swift callbacks for Apple Foundation Models (LLM) and System TTS
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

192 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 24, 2026

Additional Comments (1)

sdk/runanywhere-swift/Sources/RunAnywhere/CRACommons/include/rac_model_types.h
Struct field mismatch with C++ source. The C++ header at sdk/runanywhere-commons/include/rac/infrastructure/model_management/rac_model_types.h defines these fields as relative_path and destination_path, but this copy has url and filename. This inconsistency will cause memory corruption when C++ code writes to these structs and Swift code reads them.

Sync this struct definition with the source of truth.

Prompt To Fix With AI
This is a comment left during a code review.
Path: sdk/runanywhere-swift/Sources/RunAnywhere/CRACommons/include/rac_model_types.h
Line: 82-91

Comment:
Struct field mismatch with C++ source. The C++ header at `sdk/runanywhere-commons/include/rac/infrastructure/model_management/rac_model_types.h` defines these fields as `relative_path` and `destination_path`, but this copy has `url` and `filename`. This inconsistency will cause memory corruption when C++ code writes to these structs and Swift code reads them.

Sync this struct definition with the source of truth.

How can I resolve this? If you propose a fix, please make it concise.

@sanchitmonga22 sanchitmonga22 merged commit cc632b2 into main Feb 24, 2026
14 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants