@runanywhere/core 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RunAnywhereCore.podspec +130 -0
- package/android/CMakeLists.txt +92 -0
- package/android/build.gradle +321 -0
- package/android/consumer-rules.pro +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/cpp/cpp-adapter.cpp +271 -0
- package/android/src/main/include/rac/backends/rac_llm_llamacpp.h +218 -0
- package/android/src/main/include/rac/backends/rac_stt_onnx.h +99 -0
- package/android/src/main/include/rac/backends/rac_stt_whispercpp.h +153 -0
- package/android/src/main/include/rac/backends/rac_tts_onnx.h +71 -0
- package/android/src/main/include/rac/backends/rac_vad_onnx.h +84 -0
- package/android/src/main/include/rac/core/capabilities/rac_lifecycle.h +290 -0
- package/android/src/main/include/rac/core/rac_analytics_events.h +610 -0
- package/android/src/main/include/rac/core/rac_audio_utils.h +88 -0
- package/android/src/main/include/rac/core/rac_component_types.h +160 -0
- package/android/src/main/include/rac/core/rac_core.h +331 -0
- package/android/src/main/include/rac/core/rac_error.h +469 -0
- package/android/src/main/include/rac/core/rac_events.h +334 -0
- package/android/src/main/include/rac/core/rac_logger.h +416 -0
- package/android/src/main/include/rac/core/rac_platform_adapter.h +340 -0
- package/android/src/main/include/rac/core/rac_sdk_state.h +292 -0
- package/android/src/main/include/rac/core/rac_structured_error.h +594 -0
- package/android/src/main/include/rac/core/rac_types.h +264 -0
- package/android/src/main/include/rac/features/llm/rac_llm.h +17 -0
- package/android/src/main/include/rac/features/llm/rac_llm_analytics.h +188 -0
- package/android/src/main/include/rac/features/llm/rac_llm_component.h +228 -0
- package/android/src/main/include/rac/features/llm/rac_llm_events.h +215 -0
- package/android/src/main/include/rac/features/llm/rac_llm_metrics.h +402 -0
- package/android/src/main/include/rac/features/llm/rac_llm_service.h +163 -0
- package/android/src/main/include/rac/features/llm/rac_llm_structured_output.h +141 -0
- package/android/src/main/include/rac/features/llm/rac_llm_types.h +384 -0
- package/android/src/main/include/rac/features/platform/rac_llm_platform.h +204 -0
- package/android/src/main/include/rac/features/platform/rac_tts_platform.h +197 -0
- package/android/src/main/include/rac/features/stt/rac_stt.h +17 -0
- package/android/src/main/include/rac/features/stt/rac_stt_analytics.h +204 -0
- package/android/src/main/include/rac/features/stt/rac_stt_component.h +162 -0
- package/android/src/main/include/rac/features/stt/rac_stt_events.h +62 -0
- package/android/src/main/include/rac/features/stt/rac_stt_service.h +154 -0
- package/android/src/main/include/rac/features/stt/rac_stt_types.h +389 -0
- package/android/src/main/include/rac/features/tts/rac_tts.h +17 -0
- package/android/src/main/include/rac/features/tts/rac_tts_analytics.h +181 -0
- package/android/src/main/include/rac/features/tts/rac_tts_component.h +158 -0
- package/android/src/main/include/rac/features/tts/rac_tts_events.h +54 -0
- package/android/src/main/include/rac/features/tts/rac_tts_service.h +162 -0
- package/android/src/main/include/rac/features/tts/rac_tts_types.h +374 -0
- package/android/src/main/include/rac/features/vad/rac_vad.h +17 -0
- package/android/src/main/include/rac/features/vad/rac_vad_analytics.h +236 -0
- package/android/src/main/include/rac/features/vad/rac_vad_component.h +185 -0
- package/android/src/main/include/rac/features/vad/rac_vad_energy.h +443 -0
- package/android/src/main/include/rac/features/vad/rac_vad_events.h +76 -0
- package/android/src/main/include/rac/features/vad/rac_vad_service.h +167 -0
- package/android/src/main/include/rac/features/vad/rac_vad_types.h +244 -0
- package/android/src/main/include/rac/features/voice_agent/rac_voice_agent.h +612 -0
- package/android/src/main/include/rac/infrastructure/device/rac_device_manager.h +176 -0
- package/android/src/main/include/rac/infrastructure/download/rac_download.h +418 -0
- package/android/src/main/include/rac/infrastructure/events/rac_events.h +177 -0
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_assignment.h +169 -0
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_paths.h +258 -0
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_registry.h +357 -0
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_strategy.h +374 -0
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_types.h +613 -0
- package/android/src/main/include/rac/infrastructure/network/rac_api_types.h +335 -0
- package/android/src/main/include/rac/infrastructure/network/rac_auth_manager.h +252 -0
- package/android/src/main/include/rac/infrastructure/network/rac_dev_config.h +85 -0
- package/android/src/main/include/rac/infrastructure/network/rac_endpoints.h +102 -0
- package/android/src/main/include/rac/infrastructure/network/rac_environment.h +220 -0
- package/android/src/main/include/rac/infrastructure/network/rac_http_client.h +233 -0
- package/android/src/main/include/rac/infrastructure/storage/rac_storage_analyzer.h +286 -0
- package/android/src/main/include/rac/infrastructure/telemetry/rac_telemetry_manager.h +206 -0
- package/android/src/main/include/rac/infrastructure/telemetry/rac_telemetry_types.h +234 -0
- package/android/src/main/java/com/margelo/nitro/runanywhere/ArchiveUtility.kt +308 -0
- package/android/src/main/java/com/margelo/nitro/runanywhere/HybridRunAnywhereDeviceInfo.kt +229 -0
- package/android/src/main/java/com/margelo/nitro/runanywhere/PlatformAdapterBridge.kt +392 -0
- package/android/src/main/java/com/margelo/nitro/runanywhere/RunAnywhereCorePackage.kt +28 -0
- package/android/src/main/java/com/margelo/nitro/runanywhere/SDKLogger.kt +357 -0
- package/android/src/main/java/com/margelo/nitro/runanywhere/SecureStorageManager.kt +147 -0
- package/android/src/main/jniLibs/arm64-v8a/libc++_shared.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libomp.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/librac_commons.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/librunanywhere_jni.so +0 -0
- package/cpp/HybridRunAnywhereCore.cpp +2505 -0
- package/cpp/HybridRunAnywhereCore.hpp +271 -0
- package/cpp/bridges/AuthBridge.cpp +209 -0
- package/cpp/bridges/AuthBridge.hpp +157 -0
- package/cpp/bridges/DeviceBridge.cpp +257 -0
- package/cpp/bridges/DeviceBridge.hpp +155 -0
- package/cpp/bridges/DownloadBridge.cpp +299 -0
- package/cpp/bridges/DownloadBridge.hpp +197 -0
- package/cpp/bridges/EventBridge.cpp +125 -0
- package/cpp/bridges/EventBridge.hpp +139 -0
- package/cpp/bridges/HTTPBridge.cpp +96 -0
- package/cpp/bridges/HTTPBridge.hpp +144 -0
- package/cpp/bridges/InitBridge.cpp +1273 -0
- package/cpp/bridges/InitBridge.hpp +306 -0
- package/cpp/bridges/ModelRegistryBridge.cpp +394 -0
- package/cpp/bridges/ModelRegistryBridge.hpp +177 -0
- package/cpp/bridges/StorageBridge.cpp +269 -0
- package/cpp/bridges/StorageBridge.hpp +172 -0
- package/cpp/bridges/TelemetryBridge.cpp +352 -0
- package/cpp/bridges/TelemetryBridge.hpp +126 -0
- package/ios/.testlocal +0 -0
- package/ios/ArchiveUtility.swift +526 -0
- package/ios/ArchiveUtilityBridge.m +52 -0
- package/ios/AudioDecoder.h +38 -0
- package/ios/AudioDecoder.m +162 -0
- package/ios/Binaries/RACommons.xcframework/Info.plist +44 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/RACommons.h +67 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_analytics_events.h +610 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_api_types.h +335 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_audio_utils.h +88 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_auth_manager.h +252 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_component_types.h +160 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_core.h +331 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_dev_config.h +85 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_device_manager.h +176 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_download.h +418 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_endpoints.h +102 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_environment.h +220 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_error.h +469 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_events.h +177 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_http_client.h +233 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_lifecycle.h +290 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_analytics.h +188 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_component.h +228 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_events.h +215 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_llamacpp.h +218 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_metrics.h +402 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_platform.h +204 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_service.h +163 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_structured_output.h +141 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_types.h +384 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_logger.h +416 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_assignment.h +169 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_paths.h +258 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_registry.h +357 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_strategy.h +374 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_types.h +613 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_platform_adapter.h +340 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_sdk_state.h +292 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_storage_analyzer.h +286 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_structured_error.h +594 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_analytics.h +204 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_component.h +162 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_events.h +62 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_onnx.h +99 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_service.h +154 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_types.h +389 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_whispercpp.h +153 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_telemetry_manager.h +206 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_telemetry_types.h +234 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_analytics.h +181 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_component.h +158 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_events.h +54 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_onnx.h +71 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_platform.h +197 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_service.h +162 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_types.h +374 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_types.h +264 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_analytics.h +236 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_component.h +185 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_energy.h +443 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_events.h +76 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_onnx.h +84 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_service.h +167 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_types.h +244 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_voice_agent.h +612 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Info.plist +11 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Modules/module.modulemap +5 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/RACommons +0 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/RACommons.h +67 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_analytics_events.h +610 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_api_types.h +335 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_audio_utils.h +88 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_auth_manager.h +252 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_component_types.h +160 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_core.h +331 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_dev_config.h +85 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_device_manager.h +176 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_download.h +418 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_endpoints.h +102 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_environment.h +220 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_error.h +469 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_events.h +177 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_http_client.h +233 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_lifecycle.h +290 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_analytics.h +188 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_component.h +228 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_events.h +215 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_llamacpp.h +218 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_metrics.h +402 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_platform.h +204 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_service.h +163 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_structured_output.h +141 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_types.h +384 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_logger.h +416 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_assignment.h +169 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_paths.h +258 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_registry.h +357 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_strategy.h +374 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_types.h +613 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_platform_adapter.h +340 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_sdk_state.h +292 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_storage_analyzer.h +286 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_structured_error.h +594 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_analytics.h +204 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_component.h +162 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_events.h +62 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_onnx.h +99 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_service.h +154 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_types.h +389 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_whispercpp.h +153 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_telemetry_manager.h +206 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_telemetry_types.h +234 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_analytics.h +181 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_component.h +158 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_events.h +54 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_onnx.h +71 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_platform.h +197 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_service.h +162 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_types.h +374 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_types.h +264 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_analytics.h +236 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_component.h +185 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_energy.h +443 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_events.h +76 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_onnx.h +84 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_service.h +167 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_types.h +244 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_voice_agent.h +612 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Info.plist +11 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Modules/module.modulemap +5 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/RACommons +0 -0
- package/ios/HybridRunAnywhereDeviceInfo.swift +214 -0
- package/ios/KeychainManager.swift +116 -0
- package/ios/PlatformAdapter.swift +100 -0
- package/ios/PlatformAdapterBridge.h +152 -0
- package/ios/PlatformAdapterBridge.m +570 -0
- package/ios/RNSDKLoggerBridge.h +41 -0
- package/ios/RNSDKLoggerBridge.m +66 -0
- package/ios/SDKLogger.swift +329 -0
- package/nitro.json +20 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/c++/JHybridRunAnywhereDeviceInfoSpec.cpp +257 -0
- package/nitrogen/generated/android/c++/JHybridRunAnywhereDeviceInfoSpec.hpp +77 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/runanywhere/HybridRunAnywhereDeviceInfoSpec.kt +106 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/runanywhere/runanywherecoreOnLoad.kt +35 -0
- package/nitrogen/generated/android/runanywherecore+autolinking.cmake +82 -0
- package/nitrogen/generated/android/runanywherecore+autolinking.gradle +27 -0
- package/nitrogen/generated/android/runanywherecoreOnLoad.cpp +54 -0
- package/nitrogen/generated/android/runanywherecoreOnLoad.hpp +25 -0
- package/nitrogen/generated/ios/RunAnywhereCore+autolinking.rb +60 -0
- package/nitrogen/generated/ios/RunAnywhereCore-Swift-Cxx-Bridge.cpp +65 -0
- package/nitrogen/generated/ios/RunAnywhereCore-Swift-Cxx-Bridge.hpp +197 -0
- package/nitrogen/generated/ios/RunAnywhereCore-Swift-Cxx-Umbrella.hpp +45 -0
- package/nitrogen/generated/ios/RunAnywhereCoreAutolinking.mm +43 -0
- package/nitrogen/generated/ios/RunAnywhereCoreAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridRunAnywhereDeviceInfoSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridRunAnywhereDeviceInfoSpecSwift.hpp +173 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridRunAnywhereDeviceInfoSpec.swift +68 -0
- package/nitrogen/generated/ios/swift/HybridRunAnywhereDeviceInfoSpec_cxx.swift +366 -0
- package/nitrogen/generated/shared/c++/HybridRunAnywhereCoreSpec.cpp +92 -0
- package/nitrogen/generated/shared/c++/HybridRunAnywhereCoreSpec.hpp +138 -0
- package/nitrogen/generated/shared/c++/HybridRunAnywhereDeviceInfoSpec.cpp +33 -0
- package/nitrogen/generated/shared/c++/HybridRunAnywhereDeviceInfoSpec.hpp +75 -0
- package/package.json +76 -0
- package/react-native.config.js +14 -0
- package/src/Features/VoiceSession/AudioCaptureManager.ts +286 -0
- package/src/Features/VoiceSession/AudioPlaybackManager.ts +300 -0
- package/src/Features/VoiceSession/VoiceSessionHandle.ts +530 -0
- package/src/Features/VoiceSession/index.ts +20 -0
- package/src/Features/index.ts +7 -0
- package/src/Foundation/Constants/SDKConstants.ts +47 -0
- package/src/Foundation/Constants/index.ts +8 -0
- package/src/Foundation/DependencyInjection/ServiceContainer.ts +154 -0
- package/src/Foundation/DependencyInjection/ServiceRegistry.ts +51 -0
- package/src/Foundation/DependencyInjection/index.ts +6 -0
- package/src/Foundation/ErrorTypes/ErrorCategory.ts +184 -0
- package/src/Foundation/ErrorTypes/ErrorCodes.ts +151 -0
- package/src/Foundation/ErrorTypes/ErrorContext.ts +201 -0
- package/src/Foundation/ErrorTypes/SDKError.ts +507 -0
- package/src/Foundation/ErrorTypes/index.ts +57 -0
- package/src/Foundation/Initialization/InitializationPhase.ts +85 -0
- package/src/Foundation/Initialization/InitializationState.ts +168 -0
- package/src/Foundation/Initialization/index.ts +26 -0
- package/src/Foundation/Logging/Destinations/NativeLogBridge.ts +147 -0
- package/src/Foundation/Logging/Destinations/SentryDestination.ts +209 -0
- package/src/Foundation/Logging/Logger/SDKLogger.ts +232 -0
- package/src/Foundation/Logging/Models/LogLevel.ts +36 -0
- package/src/Foundation/Logging/Models/LoggingConfiguration.ts +117 -0
- package/src/Foundation/Logging/Services/LoggingManager.ts +407 -0
- package/src/Foundation/Logging/index.ts +59 -0
- package/src/Foundation/Security/DeviceIdentity.ts +92 -0
- package/src/Foundation/Security/SecureStorageError.ts +132 -0
- package/src/Foundation/Security/SecureStorageKeys.ts +35 -0
- package/src/Foundation/Security/SecureStorageService.ts +449 -0
- package/src/Foundation/Security/index.ts +17 -0
- package/src/Foundation/index.ts +26 -0
- package/src/Infrastructure/Events/EventPublisher.ts +165 -0
- package/src/Infrastructure/Events/SDKEvent.ts +214 -0
- package/src/Infrastructure/Events/index.ts +15 -0
- package/src/Infrastructure/index.ts +9 -0
- package/src/Public/Events/EventBus.ts +488 -0
- package/src/Public/Events/index.ts +8 -0
- package/src/Public/Extensions/RunAnywhere+Logging.ts +51 -0
- package/src/Public/Extensions/RunAnywhere+Models.ts +392 -0
- package/src/Public/Extensions/RunAnywhere+STT.ts +424 -0
- package/src/Public/Extensions/RunAnywhere+Storage.ts +151 -0
- package/src/Public/Extensions/RunAnywhere+StructuredOutput.ts +316 -0
- package/src/Public/Extensions/RunAnywhere+TTS.ts +430 -0
- package/src/Public/Extensions/RunAnywhere+TextGeneration.ts +320 -0
- package/src/Public/Extensions/RunAnywhere+VAD.ts +359 -0
- package/src/Public/Extensions/RunAnywhere+VoiceAgent.ts +225 -0
- package/src/Public/Extensions/RunAnywhere+VoiceSession.ts +155 -0
- package/src/Public/Extensions/index.ts +126 -0
- package/src/Public/RunAnywhere.ts +695 -0
- package/src/index.ts +238 -0
- package/src/native/NativeRunAnywhereCore.ts +291 -0
- package/src/native/NativeRunAnywhereModule.ts +32 -0
- package/src/native/index.ts +21 -0
- package/src/services/DownloadService.ts +282 -0
- package/src/services/FileSystem.ts +810 -0
- package/src/services/ModelRegistry.ts +246 -0
- package/src/services/Network/APIEndpoints.ts +84 -0
- package/src/services/Network/HTTPService.ts +479 -0
- package/src/services/Network/NetworkConfiguration.ts +130 -0
- package/src/services/Network/TelemetryService.ts +318 -0
- package/src/services/Network/index.ts +29 -0
- package/src/services/SystemTTSService.ts +130 -0
- package/src/services/index.ts +66 -0
- package/src/specs/RunAnywhereCore.nitro.ts +627 -0
- package/src/specs/RunAnywhereDeviceInfo.nitro.ts +73 -0
- package/src/types/LLMTypes.ts +127 -0
- package/src/types/STTTypes.ts +124 -0
- package/src/types/StructuredOutputTypes.ts +156 -0
- package/src/types/TTSTypes.ts +126 -0
- package/src/types/VADTypes.ts +70 -0
- package/src/types/VoiceAgentTypes.ts +182 -0
- package/src/types/enums.ts +258 -0
- package/src/types/events.ts +337 -0
- package/src/types/external.d.ts +142 -0
- package/src/types/index.ts +146 -0
- package/src/types/models.ts +579 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file InitBridge.hpp
|
|
3
|
+
* @brief SDK initialization bridge for React Native
|
|
4
|
+
*
|
|
5
|
+
* Handles rac_init() and rac_shutdown() lifecycle management.
|
|
6
|
+
* Registers platform adapter with callbacks for file I/O, logging, secure storage.
|
|
7
|
+
*
|
|
8
|
+
* Matches Swift's CppBridge initialization pattern.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
#include <functional>
|
|
15
|
+
#include <memory>
|
|
16
|
+
#include <tuple>
|
|
17
|
+
|
|
18
|
+
// RACommons headers
|
|
19
|
+
#include "rac_core.h"
|
|
20
|
+
#include "rac_types.h"
|
|
21
|
+
#include "rac_platform_adapter.h"
|
|
22
|
+
#include "rac_sdk_state.h"
|
|
23
|
+
#include "rac_environment.h"
|
|
24
|
+
#include "rac_model_paths.h"
|
|
25
|
+
|
|
26
|
+
namespace runanywhere {
|
|
27
|
+
namespace bridges {
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @brief Platform callbacks provided by React Native/JavaScript layer
|
|
31
|
+
*
|
|
32
|
+
* These callbacks are invoked by C++ when platform-specific operations are needed.
|
|
33
|
+
*/
|
|
34
|
+
struct PlatformCallbacks {
|
|
35
|
+
// File operations
|
|
36
|
+
std::function<bool(const std::string& path)> fileExists;
|
|
37
|
+
std::function<std::string(const std::string& path)> fileRead;
|
|
38
|
+
std::function<bool(const std::string& path, const std::string& data)> fileWrite;
|
|
39
|
+
std::function<bool(const std::string& path)> fileDelete;
|
|
40
|
+
|
|
41
|
+
// Secure storage (keychain/keystore)
|
|
42
|
+
std::function<std::string(const std::string& key)> secureGet;
|
|
43
|
+
std::function<bool(const std::string& key, const std::string& value)> secureSet;
|
|
44
|
+
std::function<bool(const std::string& key)> secureDelete;
|
|
45
|
+
|
|
46
|
+
// Logging
|
|
47
|
+
std::function<void(int level, const std::string& category, const std::string& message)> log;
|
|
48
|
+
|
|
49
|
+
// Clock
|
|
50
|
+
std::function<int64_t()> nowMs;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @brief SDK Environment enum matching Swift's SDKEnvironment
|
|
55
|
+
*/
|
|
56
|
+
enum class SDKEnvironment {
|
|
57
|
+
Development = 0,
|
|
58
|
+
Staging = 1,
|
|
59
|
+
Production = 2
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @brief SDK initialization bridge singleton
|
|
64
|
+
*
|
|
65
|
+
* Manages the lifecycle of the runanywhere-commons SDK.
|
|
66
|
+
* Registers platform adapter and initializes state.
|
|
67
|
+
*/
|
|
68
|
+
class InitBridge {
|
|
69
|
+
public:
|
|
70
|
+
static InitBridge& shared();
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @brief Register platform callbacks
|
|
74
|
+
*
|
|
75
|
+
* Must be called BEFORE initialize() to set up platform operations.
|
|
76
|
+
*
|
|
77
|
+
* @param callbacks Platform-specific callbacks
|
|
78
|
+
*/
|
|
79
|
+
void setPlatformCallbacks(const PlatformCallbacks& callbacks);
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @brief Initialize the SDK
|
|
83
|
+
*
|
|
84
|
+
* 1. Registers platform adapter with RACommons
|
|
85
|
+
* 2. Configures logging for environment
|
|
86
|
+
* 3. Initializes SDK state
|
|
87
|
+
*
|
|
88
|
+
* @param environment SDK environment (development, staging, production)
|
|
89
|
+
* @param apiKey API key for authentication
|
|
90
|
+
* @param baseURL Base URL for API requests
|
|
91
|
+
* @param deviceId Persistent device identifier
|
|
92
|
+
* @return RAC_SUCCESS or error code
|
|
93
|
+
*/
|
|
94
|
+
rac_result_t initialize(SDKEnvironment environment,
|
|
95
|
+
const std::string& apiKey,
|
|
96
|
+
const std::string& baseURL,
|
|
97
|
+
const std::string& deviceId);
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @brief Set base directory for model paths
|
|
101
|
+
*
|
|
102
|
+
* Must be called after initialize() and before using model path utilities.
|
|
103
|
+
* Mirrors Swift's CppBridge.ModelPaths.setBaseDirectory().
|
|
104
|
+
*
|
|
105
|
+
* @param documentsPath Path to Documents directory
|
|
106
|
+
* @return RAC_SUCCESS or error code
|
|
107
|
+
*/
|
|
108
|
+
rac_result_t setBaseDirectory(const std::string& documentsPath);
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @brief Shutdown the SDK
|
|
112
|
+
*/
|
|
113
|
+
void shutdown();
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @brief Check if SDK is initialized
|
|
117
|
+
*/
|
|
118
|
+
bool isInitialized() const { return initialized_; }
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @brief Get current environment
|
|
122
|
+
*/
|
|
123
|
+
SDKEnvironment getEnvironment() const { return environment_; }
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @brief Convert SDK environment to RAC environment
|
|
127
|
+
*/
|
|
128
|
+
static rac_environment_t toRacEnvironment(SDKEnvironment env);
|
|
129
|
+
|
|
130
|
+
// =========================================================================
|
|
131
|
+
// Secure Storage Methods
|
|
132
|
+
// Matches Swift: KeychainManager
|
|
133
|
+
// =========================================================================
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @brief Store a value in secure storage (Keychain/Keystore)
|
|
137
|
+
* @param key Storage key
|
|
138
|
+
* @param value Value to store
|
|
139
|
+
* @return true if successful
|
|
140
|
+
*/
|
|
141
|
+
bool secureSet(const std::string& key, const std::string& value);
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @brief Get a value from secure storage
|
|
145
|
+
* @param key Storage key
|
|
146
|
+
* @param outValue Output value (empty if not found)
|
|
147
|
+
* @return true if value found and retrieved
|
|
148
|
+
*/
|
|
149
|
+
bool secureGet(const std::string& key, std::string& outValue);
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @brief Delete a value from secure storage
|
|
153
|
+
* @param key Storage key
|
|
154
|
+
* @return true if deleted or didn't exist
|
|
155
|
+
*/
|
|
156
|
+
bool secureDelete(const std::string& key);
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* @brief Check if a key exists in secure storage
|
|
160
|
+
* @param key Storage key
|
|
161
|
+
* @return true if key exists
|
|
162
|
+
*/
|
|
163
|
+
bool secureExists(const std::string& key);
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* @brief Get or create persistent device UUID
|
|
167
|
+
*
|
|
168
|
+
* Strategy (matches Swift DeviceIdentity):
|
|
169
|
+
* 1. Try to load from secure storage (survives reinstalls)
|
|
170
|
+
* 2. If not found, generate new UUID and store
|
|
171
|
+
*
|
|
172
|
+
* @return Persistent device UUID
|
|
173
|
+
*/
|
|
174
|
+
std::string getPersistentDeviceUUID();
|
|
175
|
+
|
|
176
|
+
// =========================================================================
|
|
177
|
+
// Device Info (Synchronous)
|
|
178
|
+
// For device registration callback which must be synchronous
|
|
179
|
+
// =========================================================================
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* @brief Get device model name (e.g., "iPhone 16 Pro Max")
|
|
183
|
+
*/
|
|
184
|
+
std::string getDeviceModel();
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* @brief Get OS version (e.g., "18.2")
|
|
188
|
+
*/
|
|
189
|
+
std::string getOSVersion();
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* @brief Get chip name (e.g., "A18 Pro")
|
|
193
|
+
*/
|
|
194
|
+
std::string getChipName();
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* @brief Get total memory in bytes
|
|
198
|
+
*/
|
|
199
|
+
uint64_t getTotalMemory();
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @brief Get available memory in bytes
|
|
203
|
+
*/
|
|
204
|
+
uint64_t getAvailableMemory();
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* @brief Get CPU core count
|
|
208
|
+
*/
|
|
209
|
+
int getCoreCount();
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* @brief Get architecture (e.g., "arm64")
|
|
213
|
+
*/
|
|
214
|
+
std::string getArchitecture();
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* @brief Get GPU family (e.g., "mali", "adreno")
|
|
218
|
+
*/
|
|
219
|
+
std::string getGPUFamily();
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* @brief Check if device is a tablet
|
|
223
|
+
* Uses platform-specific detection (UIDevice on iOS, Configuration on Android)
|
|
224
|
+
* Matches Swift SDK: device.userInterfaceIdiom == .pad
|
|
225
|
+
*/
|
|
226
|
+
bool isTablet();
|
|
227
|
+
|
|
228
|
+
// =========================================================================
|
|
229
|
+
// Configuration Getters (for HTTP requests in production mode)
|
|
230
|
+
// =========================================================================
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* @brief Get configured API key
|
|
234
|
+
*/
|
|
235
|
+
std::string getApiKey() const { return apiKey_; }
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* @brief Get configured base URL
|
|
239
|
+
*/
|
|
240
|
+
std::string getBaseURL() const { return baseURL_; }
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* @brief Set SDK version (passed from TypeScript layer)
|
|
244
|
+
* Must be called during initialization to ensure consistency
|
|
245
|
+
*/
|
|
246
|
+
void setSdkVersion(const std::string& version) { sdkVersion_ = version; }
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* @brief Get SDK version
|
|
250
|
+
* Returns centralized version passed from TypeScript SDKConstants
|
|
251
|
+
*/
|
|
252
|
+
std::string getSdkVersion() const { return sdkVersion_.empty() ? "0.2.0" : sdkVersion_; }
|
|
253
|
+
|
|
254
|
+
// Note: getEnvironment() already defined above in "SDK Environment" section
|
|
255
|
+
|
|
256
|
+
// =========================================================================
|
|
257
|
+
// HTTP Methods for Device Registration
|
|
258
|
+
// Matches Swift: CppBridge+Device.swift http_post callback
|
|
259
|
+
// =========================================================================
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* @brief Synchronous HTTP POST for device registration
|
|
263
|
+
*
|
|
264
|
+
* Uses native URLSession (iOS) or HttpURLConnection (Android).
|
|
265
|
+
* Required by C++ rac_device_manager which expects synchronous HTTP.
|
|
266
|
+
*
|
|
267
|
+
* @param url Full URL to POST to
|
|
268
|
+
* @param jsonBody JSON body string
|
|
269
|
+
* @param supabaseKey Supabase API key (for dev mode, empty for prod)
|
|
270
|
+
* @return tuple<success, statusCode, responseBody, errorMessage>
|
|
271
|
+
*/
|
|
272
|
+
std::tuple<bool, int, std::string, std::string> httpPostSync(
|
|
273
|
+
const std::string& url,
|
|
274
|
+
const std::string& jsonBody,
|
|
275
|
+
const std::string& supabaseKey
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
private:
|
|
279
|
+
InitBridge() = default;
|
|
280
|
+
~InitBridge();
|
|
281
|
+
|
|
282
|
+
// Disable copy/move
|
|
283
|
+
InitBridge(const InitBridge&) = delete;
|
|
284
|
+
InitBridge& operator=(const InitBridge&) = delete;
|
|
285
|
+
|
|
286
|
+
void registerPlatformAdapter();
|
|
287
|
+
|
|
288
|
+
bool initialized_ = false;
|
|
289
|
+
bool adapterRegistered_ = false;
|
|
290
|
+
SDKEnvironment environment_ = SDKEnvironment::Development;
|
|
291
|
+
|
|
292
|
+
// Configuration stored at initialization
|
|
293
|
+
std::string apiKey_;
|
|
294
|
+
std::string baseURL_;
|
|
295
|
+
std::string deviceId_;
|
|
296
|
+
std::string sdkVersion_; // SDK version from TypeScript SDKConstants
|
|
297
|
+
|
|
298
|
+
// Platform adapter - must persist for C++ to call
|
|
299
|
+
rac_platform_adapter_t adapter_{};
|
|
300
|
+
|
|
301
|
+
// Platform callbacks from JS layer
|
|
302
|
+
PlatformCallbacks callbacks_{};
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
} // namespace bridges
|
|
306
|
+
} // namespace runanywhere
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file ModelRegistryBridge.cpp
|
|
3
|
+
* @brief C++ bridge for model registry operations.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors Swift's CppBridge+ModelRegistry.swift pattern.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#include "ModelRegistryBridge.hpp"
|
|
9
|
+
#include "rac_core.h" // For rac_get_model_registry()
|
|
10
|
+
#include <cstring>
|
|
11
|
+
|
|
12
|
+
// Platform-specific logging
|
|
13
|
+
#if defined(ANDROID) || defined(__ANDROID__)
|
|
14
|
+
#include <android/log.h>
|
|
15
|
+
#define LOG_TAG "ModelRegistryBridge"
|
|
16
|
+
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
|
|
17
|
+
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
|
|
18
|
+
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
|
|
19
|
+
#else
|
|
20
|
+
#include <cstdio>
|
|
21
|
+
#define LOGI(...) printf("[ModelRegistryBridge] "); printf(__VA_ARGS__); printf("\n")
|
|
22
|
+
#define LOGD(...) printf("[ModelRegistryBridge DEBUG] "); printf(__VA_ARGS__); printf("\n")
|
|
23
|
+
#define LOGE(...) printf("[ModelRegistryBridge ERROR] "); printf(__VA_ARGS__); printf("\n")
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace runanywhere {
|
|
27
|
+
namespace bridges {
|
|
28
|
+
|
|
29
|
+
ModelRegistryBridge& ModelRegistryBridge::shared() {
|
|
30
|
+
static ModelRegistryBridge instance;
|
|
31
|
+
return instance;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
ModelRegistryBridge::~ModelRegistryBridge() {
|
|
35
|
+
shutdown();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
rac_result_t ModelRegistryBridge::initialize() {
|
|
39
|
+
if (handle_) {
|
|
40
|
+
LOGD("Model registry already initialized");
|
|
41
|
+
return RAC_SUCCESS;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Use the GLOBAL model registry (same as Swift SDK)
|
|
45
|
+
// This ensures models registered by backends are visible to the SDK
|
|
46
|
+
handle_ = rac_get_model_registry();
|
|
47
|
+
|
|
48
|
+
if (handle_) {
|
|
49
|
+
LOGI("Using global C++ model registry");
|
|
50
|
+
return RAC_SUCCESS;
|
|
51
|
+
} else {
|
|
52
|
+
LOGE("Failed to get global model registry");
|
|
53
|
+
return RAC_ERROR_NOT_INITIALIZED;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
void ModelRegistryBridge::shutdown() {
|
|
58
|
+
// NOTE: We're using the GLOBAL registry - DO NOT clear the handle
|
|
59
|
+
// The global registry persists for the lifetime of the app
|
|
60
|
+
// Just log that shutdown was called, but don't actually release the handle
|
|
61
|
+
LOGI("Model registry shutdown called (global registry handle retained)");
|
|
62
|
+
// DO NOT: handle_ = nullptr;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
ModelInfo ModelRegistryBridge::fromRac(const rac_model_info_t& cModel) {
|
|
66
|
+
ModelInfo model;
|
|
67
|
+
|
|
68
|
+
model.id = cModel.id ? cModel.id : "";
|
|
69
|
+
model.name = cModel.name ? cModel.name : "";
|
|
70
|
+
model.description = cModel.description ? cModel.description : "";
|
|
71
|
+
model.category = cModel.category;
|
|
72
|
+
model.format = cModel.format;
|
|
73
|
+
model.framework = cModel.framework;
|
|
74
|
+
model.downloadUrl = cModel.download_url ? cModel.download_url : "";
|
|
75
|
+
model.localPath = cModel.local_path ? cModel.local_path : "";
|
|
76
|
+
model.downloadSize = cModel.download_size;
|
|
77
|
+
model.memoryRequired = cModel.memory_required;
|
|
78
|
+
model.contextLength = cModel.context_length;
|
|
79
|
+
model.supportsThinking = cModel.supports_thinking == RAC_TRUE;
|
|
80
|
+
model.source = cModel.source;
|
|
81
|
+
|
|
82
|
+
// Copy tags
|
|
83
|
+
if (cModel.tags && cModel.tag_count > 0) {
|
|
84
|
+
for (size_t i = 0; i < cModel.tag_count; i++) {
|
|
85
|
+
if (cModel.tags[i]) {
|
|
86
|
+
model.tags.push_back(cModel.tags[i]);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Check if downloaded
|
|
92
|
+
model.isDownloaded = !model.localPath.empty() && model.localPath[0] != '\0';
|
|
93
|
+
|
|
94
|
+
return model;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
void ModelRegistryBridge::toRac(const ModelInfo& model, rac_model_info_t& cModel) {
|
|
98
|
+
// Note: This allocates strings that must be freed
|
|
99
|
+
// For now we use static storage for simplicity
|
|
100
|
+
static std::string s_id, s_name, s_desc, s_url, s_path;
|
|
101
|
+
static std::vector<std::string> s_tags;
|
|
102
|
+
static std::vector<const char*> s_tagPtrs;
|
|
103
|
+
|
|
104
|
+
s_id = model.id;
|
|
105
|
+
s_name = model.name;
|
|
106
|
+
s_desc = model.description;
|
|
107
|
+
s_url = model.downloadUrl;
|
|
108
|
+
s_path = model.localPath;
|
|
109
|
+
|
|
110
|
+
memset(&cModel, 0, sizeof(cModel));
|
|
111
|
+
|
|
112
|
+
cModel.id = const_cast<char*>(s_id.c_str());
|
|
113
|
+
cModel.name = const_cast<char*>(s_name.c_str());
|
|
114
|
+
cModel.description = s_desc.empty() ? nullptr : const_cast<char*>(s_desc.c_str());
|
|
115
|
+
cModel.category = model.category;
|
|
116
|
+
cModel.format = model.format;
|
|
117
|
+
cModel.framework = model.framework;
|
|
118
|
+
cModel.download_url = s_url.empty() ? nullptr : const_cast<char*>(s_url.c_str());
|
|
119
|
+
cModel.local_path = s_path.empty() ? nullptr : const_cast<char*>(s_path.c_str());
|
|
120
|
+
cModel.download_size = model.downloadSize;
|
|
121
|
+
cModel.memory_required = model.memoryRequired;
|
|
122
|
+
cModel.context_length = model.contextLength;
|
|
123
|
+
cModel.supports_thinking = model.supportsThinking ? RAC_TRUE : RAC_FALSE;
|
|
124
|
+
cModel.source = model.source;
|
|
125
|
+
|
|
126
|
+
// Setup tags
|
|
127
|
+
s_tags = model.tags;
|
|
128
|
+
s_tagPtrs.clear();
|
|
129
|
+
for (const auto& tag : s_tags) {
|
|
130
|
+
s_tagPtrs.push_back(tag.c_str());
|
|
131
|
+
}
|
|
132
|
+
if (!s_tagPtrs.empty()) {
|
|
133
|
+
cModel.tags = const_cast<char**>(s_tagPtrs.data());
|
|
134
|
+
cModel.tag_count = s_tagPtrs.size();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
rac_result_t ModelRegistryBridge::addModel(const ModelInfo& model) {
|
|
139
|
+
if (!handle_) {
|
|
140
|
+
return RAC_ERROR_NOT_INITIALIZED;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
rac_model_info_t cModel;
|
|
144
|
+
toRac(model, cModel);
|
|
145
|
+
|
|
146
|
+
// Use rac_model_registry_save to add/update a model
|
|
147
|
+
rac_result_t result = rac_model_registry_save(handle_, &cModel);
|
|
148
|
+
|
|
149
|
+
if (result == RAC_SUCCESS) {
|
|
150
|
+
LOGI("Added model: %s", model.id.c_str());
|
|
151
|
+
} else {
|
|
152
|
+
LOGE("Failed to add model %s: %d", model.id.c_str(), result);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
rac_result_t ModelRegistryBridge::removeModel(const std::string& modelId) {
|
|
159
|
+
if (!handle_) {
|
|
160
|
+
return RAC_ERROR_NOT_INITIALIZED;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
rac_result_t result = rac_model_registry_remove(handle_, modelId.c_str());
|
|
164
|
+
|
|
165
|
+
if (result == RAC_SUCCESS) {
|
|
166
|
+
LOGI("Removed model: %s", modelId.c_str());
|
|
167
|
+
} else {
|
|
168
|
+
LOGE("Failed to remove model %s: %d", modelId.c_str(), result);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return result;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
rac_result_t ModelRegistryBridge::updateModelPath(const std::string& modelId, const std::string& localPath) {
|
|
175
|
+
if (!handle_) {
|
|
176
|
+
return RAC_ERROR_NOT_INITIALIZED;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Use rac_model_registry_update_download_status to update the model's local path
|
|
180
|
+
rac_result_t result = rac_model_registry_update_download_status(handle_, modelId.c_str(), localPath.c_str());
|
|
181
|
+
|
|
182
|
+
if (result == RAC_SUCCESS) {
|
|
183
|
+
LOGI("Updated model path: %s -> %s", modelId.c_str(), localPath.c_str());
|
|
184
|
+
} else {
|
|
185
|
+
LOGE("Failed to update model path %s: %d", modelId.c_str(), result);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return result;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
std::optional<ModelInfo> ModelRegistryBridge::getModel(const std::string& modelId) {
|
|
192
|
+
if (!handle_) {
|
|
193
|
+
return std::nullopt;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
rac_model_info_t* cModel = nullptr;
|
|
197
|
+
rac_result_t result = rac_model_registry_get(handle_, modelId.c_str(), &cModel);
|
|
198
|
+
|
|
199
|
+
if (result != RAC_SUCCESS || !cModel) {
|
|
200
|
+
return std::nullopt;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
ModelInfo model = fromRac(*cModel);
|
|
204
|
+
rac_model_info_free(cModel);
|
|
205
|
+
|
|
206
|
+
return model;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
std::vector<ModelInfo> ModelRegistryBridge::getAllModels() {
|
|
210
|
+
std::vector<ModelInfo> models;
|
|
211
|
+
|
|
212
|
+
if (!handle_) {
|
|
213
|
+
LOGE("getAllModels: Registry not initialized!");
|
|
214
|
+
return models;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
rac_model_info_t** cModels = nullptr;
|
|
218
|
+
size_t count = 0;
|
|
219
|
+
|
|
220
|
+
LOGD("getAllModels: Calling rac_model_registry_get_all with handle=%p", handle_);
|
|
221
|
+
|
|
222
|
+
rac_result_t result = rac_model_registry_get_all(handle_, &cModels, &count);
|
|
223
|
+
|
|
224
|
+
LOGI("getAllModels: result=%d, count=%zu", result, count);
|
|
225
|
+
|
|
226
|
+
if (result != RAC_SUCCESS || !cModels) {
|
|
227
|
+
LOGE("getAllModels: Failed with result=%d, cModels=%p", result, (void*)cModels);
|
|
228
|
+
return models;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
for (size_t i = 0; i < count; i++) {
|
|
232
|
+
if (cModels[i]) {
|
|
233
|
+
models.push_back(fromRac(*cModels[i]));
|
|
234
|
+
LOGD("getAllModels: Added model %s", cModels[i]->id);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
rac_model_info_array_free(cModels, count);
|
|
239
|
+
|
|
240
|
+
LOGI("getAllModels: Returning %zu models", models.size());
|
|
241
|
+
|
|
242
|
+
return models;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
std::vector<ModelInfo> ModelRegistryBridge::getModels(const ModelFilter& filter) {
|
|
246
|
+
std::vector<ModelInfo> models;
|
|
247
|
+
|
|
248
|
+
if (!handle_) {
|
|
249
|
+
return models;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// Get all models first
|
|
253
|
+
rac_model_info_t** cModels = nullptr;
|
|
254
|
+
size_t count = 0;
|
|
255
|
+
|
|
256
|
+
rac_result_t result = rac_model_registry_get_all(handle_, &cModels, &count);
|
|
257
|
+
|
|
258
|
+
if (result != RAC_SUCCESS || !cModels) {
|
|
259
|
+
return models;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// Setup filter
|
|
263
|
+
rac_model_filter_t cFilter = {};
|
|
264
|
+
cFilter.framework = filter.framework;
|
|
265
|
+
cFilter.format = filter.format;
|
|
266
|
+
cFilter.max_size = filter.maxSize;
|
|
267
|
+
cFilter.search_query = filter.searchQuery.empty() ? nullptr : filter.searchQuery.c_str();
|
|
268
|
+
|
|
269
|
+
// Apply filter using rac_model_matches_filter helper
|
|
270
|
+
for (size_t i = 0; i < count; i++) {
|
|
271
|
+
if (cModels[i]) {
|
|
272
|
+
if (rac_model_matches_filter(cModels[i], &cFilter) == RAC_TRUE) {
|
|
273
|
+
models.push_back(fromRac(*cModels[i]));
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
rac_model_info_array_free(cModels, count);
|
|
279
|
+
|
|
280
|
+
return models;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
std::vector<ModelInfo> ModelRegistryBridge::getModelsByFramework(rac_inference_framework_t framework) {
|
|
284
|
+
ModelFilter filter;
|
|
285
|
+
filter.framework = framework;
|
|
286
|
+
return getModels(filter);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
std::vector<ModelInfo> ModelRegistryBridge::getDownloadedModels() {
|
|
290
|
+
std::vector<ModelInfo> models;
|
|
291
|
+
|
|
292
|
+
if (!handle_) {
|
|
293
|
+
return models;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
rac_model_info_t** cModels = nullptr;
|
|
297
|
+
size_t count = 0;
|
|
298
|
+
|
|
299
|
+
rac_result_t result = rac_model_registry_get_downloaded(handle_, &cModels, &count);
|
|
300
|
+
|
|
301
|
+
if (result != RAC_SUCCESS || !cModels) {
|
|
302
|
+
return models;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
for (size_t i = 0; i < count; i++) {
|
|
306
|
+
if (cModels[i]) {
|
|
307
|
+
models.push_back(fromRac(*cModels[i]));
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
rac_model_info_array_free(cModels, count);
|
|
312
|
+
|
|
313
|
+
return models;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
bool ModelRegistryBridge::modelExists(const std::string& modelId) {
|
|
317
|
+
if (!handle_) {
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// Check existence by trying to get the model
|
|
322
|
+
rac_model_info_t* cModel = nullptr;
|
|
323
|
+
rac_result_t result = rac_model_registry_get(handle_, modelId.c_str(), &cModel);
|
|
324
|
+
|
|
325
|
+
if (result == RAC_SUCCESS && cModel) {
|
|
326
|
+
rac_model_info_free(cModel);
|
|
327
|
+
return true;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
return false;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
bool ModelRegistryBridge::isModelDownloaded(const std::string& modelId) {
|
|
334
|
+
if (!handle_) {
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// Get the model and check its download status
|
|
339
|
+
rac_model_info_t* cModel = nullptr;
|
|
340
|
+
rac_result_t result = rac_model_registry_get(handle_, modelId.c_str(), &cModel);
|
|
341
|
+
|
|
342
|
+
if (result != RAC_SUCCESS || !cModel) {
|
|
343
|
+
return false;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
rac_bool_t downloaded = rac_model_info_is_downloaded(cModel);
|
|
347
|
+
rac_model_info_free(cModel);
|
|
348
|
+
|
|
349
|
+
return downloaded == RAC_TRUE;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
std::optional<std::string> ModelRegistryBridge::getModelPath(const std::string& modelId) {
|
|
353
|
+
if (!handle_) {
|
|
354
|
+
return std::nullopt;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// Get the model and extract its local_path
|
|
358
|
+
rac_model_info_t* cModel = nullptr;
|
|
359
|
+
rac_result_t result = rac_model_registry_get(handle_, modelId.c_str(), &cModel);
|
|
360
|
+
|
|
361
|
+
if (result != RAC_SUCCESS || !cModel) {
|
|
362
|
+
return std::nullopt;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
std::string pathStr;
|
|
366
|
+
if (cModel->local_path && cModel->local_path[0] != '\0') {
|
|
367
|
+
pathStr = cModel->local_path;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
rac_model_info_free(cModel);
|
|
371
|
+
|
|
372
|
+
return pathStr.empty() ? std::nullopt : std::make_optional(pathStr);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
size_t ModelRegistryBridge::getModelCount() {
|
|
376
|
+
if (!handle_) {
|
|
377
|
+
return 0;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// Get count by getting all models
|
|
381
|
+
rac_model_info_t** cModels = nullptr;
|
|
382
|
+
size_t count = 0;
|
|
383
|
+
|
|
384
|
+
rac_result_t result = rac_model_registry_get_all(handle_, &cModels, &count);
|
|
385
|
+
|
|
386
|
+
if (result == RAC_SUCCESS && cModels) {
|
|
387
|
+
rac_model_info_array_free(cModels, count);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
return count;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
} // namespace bridges
|
|
394
|
+
} // namespace runanywhere
|