@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,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file ModelRegistryBridge.hpp
|
|
3
|
+
* @brief C++ bridge for model registry operations.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors Swift's CppBridge+ModelRegistry.swift pattern:
|
|
6
|
+
* - Handle-based API via rac_model_registry_*
|
|
7
|
+
* - Model management and queries
|
|
8
|
+
*
|
|
9
|
+
* Reference: sdk/runanywhere-swift/Sources/RunAnywhere/Foundation/Bridge/Extensions/CppBridge+ModelRegistry.swift
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
#pragma once
|
|
13
|
+
|
|
14
|
+
#include <string>
|
|
15
|
+
#include <vector>
|
|
16
|
+
#include <optional>
|
|
17
|
+
#include <cstdint>
|
|
18
|
+
|
|
19
|
+
#include "rac_types.h"
|
|
20
|
+
#include "rac_model_registry.h"
|
|
21
|
+
#include "rac_model_types.h"
|
|
22
|
+
|
|
23
|
+
namespace runanywhere {
|
|
24
|
+
namespace bridges {
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Model info wrapper for C++ use
|
|
28
|
+
*/
|
|
29
|
+
struct ModelInfo {
|
|
30
|
+
std::string id;
|
|
31
|
+
std::string name;
|
|
32
|
+
std::string description;
|
|
33
|
+
rac_model_category_t category = RAC_MODEL_CATEGORY_UNKNOWN;
|
|
34
|
+
rac_model_format_t format = RAC_MODEL_FORMAT_UNKNOWN;
|
|
35
|
+
rac_inference_framework_t framework = RAC_FRAMEWORK_UNKNOWN;
|
|
36
|
+
std::string downloadUrl;
|
|
37
|
+
std::string localPath;
|
|
38
|
+
int64_t downloadSize = 0;
|
|
39
|
+
int64_t memoryRequired = 0;
|
|
40
|
+
int32_t contextLength = 0;
|
|
41
|
+
bool supportsThinking = false;
|
|
42
|
+
std::vector<std::string> tags;
|
|
43
|
+
rac_model_source_t source = RAC_MODEL_SOURCE_REMOTE;
|
|
44
|
+
bool isDownloaded = false;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Model filter criteria
|
|
49
|
+
*/
|
|
50
|
+
struct ModelFilter {
|
|
51
|
+
rac_inference_framework_t framework = RAC_FRAMEWORK_UNKNOWN;
|
|
52
|
+
rac_model_format_t format = RAC_MODEL_FORMAT_UNKNOWN;
|
|
53
|
+
rac_model_category_t category = RAC_MODEL_CATEGORY_UNKNOWN;
|
|
54
|
+
int64_t maxSize = 0;
|
|
55
|
+
std::string searchQuery;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* ModelRegistryBridge - Model registry via rac_model_registry_* API
|
|
60
|
+
*
|
|
61
|
+
* Mirrors Swift's CppBridge.ModelRegistry pattern:
|
|
62
|
+
* - Handle-based API
|
|
63
|
+
* - Model CRUD operations
|
|
64
|
+
* - Query and filtering
|
|
65
|
+
*/
|
|
66
|
+
class ModelRegistryBridge {
|
|
67
|
+
public:
|
|
68
|
+
/**
|
|
69
|
+
* Get shared instance
|
|
70
|
+
*/
|
|
71
|
+
static ModelRegistryBridge& shared();
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Initialize the model registry
|
|
75
|
+
*/
|
|
76
|
+
rac_result_t initialize();
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Shutdown and cleanup
|
|
80
|
+
*/
|
|
81
|
+
void shutdown();
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Check if initialized
|
|
85
|
+
*/
|
|
86
|
+
bool isInitialized() const { return handle_ != nullptr; }
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Get the underlying handle (for use by other bridges)
|
|
90
|
+
*/
|
|
91
|
+
rac_model_registry_handle_t getHandle() const { return handle_; }
|
|
92
|
+
|
|
93
|
+
// =========================================================================
|
|
94
|
+
// Model CRUD Operations
|
|
95
|
+
// =========================================================================
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Add a model to the registry
|
|
99
|
+
*/
|
|
100
|
+
rac_result_t addModel(const ModelInfo& model);
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Remove a model from the registry
|
|
104
|
+
*/
|
|
105
|
+
rac_result_t removeModel(const std::string& modelId);
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Update model local path after download
|
|
109
|
+
*/
|
|
110
|
+
rac_result_t updateModelPath(const std::string& modelId, const std::string& localPath);
|
|
111
|
+
|
|
112
|
+
// =========================================================================
|
|
113
|
+
// Model Queries
|
|
114
|
+
// =========================================================================
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Get a model by ID
|
|
118
|
+
*/
|
|
119
|
+
std::optional<ModelInfo> getModel(const std::string& modelId);
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Get all models
|
|
123
|
+
*/
|
|
124
|
+
std::vector<ModelInfo> getAllModels();
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Get models filtered by criteria
|
|
128
|
+
*/
|
|
129
|
+
std::vector<ModelInfo> getModels(const ModelFilter& filter);
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Get models by framework
|
|
133
|
+
*/
|
|
134
|
+
std::vector<ModelInfo> getModelsByFramework(rac_inference_framework_t framework);
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Get downloaded models
|
|
138
|
+
*/
|
|
139
|
+
std::vector<ModelInfo> getDownloadedModels();
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Check if a model exists
|
|
143
|
+
*/
|
|
144
|
+
bool modelExists(const std::string& modelId);
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Check if a model is downloaded
|
|
148
|
+
*/
|
|
149
|
+
bool isModelDownloaded(const std::string& modelId);
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Get model path if downloaded
|
|
153
|
+
*/
|
|
154
|
+
std::optional<std::string> getModelPath(const std::string& modelId);
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Get model count
|
|
158
|
+
*/
|
|
159
|
+
size_t getModelCount();
|
|
160
|
+
|
|
161
|
+
private:
|
|
162
|
+
ModelRegistryBridge() = default;
|
|
163
|
+
~ModelRegistryBridge();
|
|
164
|
+
ModelRegistryBridge(const ModelRegistryBridge&) = delete;
|
|
165
|
+
ModelRegistryBridge& operator=(const ModelRegistryBridge&) = delete;
|
|
166
|
+
|
|
167
|
+
// Convert C model info to C++ wrapper
|
|
168
|
+
static ModelInfo fromRac(const rac_model_info_t& cModel);
|
|
169
|
+
|
|
170
|
+
// Convert C++ wrapper to C model info
|
|
171
|
+
static void toRac(const ModelInfo& model, rac_model_info_t& cModel);
|
|
172
|
+
|
|
173
|
+
rac_model_registry_handle_t handle_ = nullptr;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
} // namespace bridges
|
|
177
|
+
} // namespace runanywhere
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file StorageBridge.cpp
|
|
3
|
+
* @brief C++ bridge for storage operations.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors Swift's CppBridge+Storage.swift pattern.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#include "StorageBridge.hpp"
|
|
9
|
+
#include <cstring>
|
|
10
|
+
|
|
11
|
+
// Platform-specific logging
|
|
12
|
+
#if defined(ANDROID) || defined(__ANDROID__)
|
|
13
|
+
#include <android/log.h>
|
|
14
|
+
#define LOG_TAG "StorageBridge"
|
|
15
|
+
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
|
|
16
|
+
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
|
|
17
|
+
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
|
|
18
|
+
#else
|
|
19
|
+
#include <cstdio>
|
|
20
|
+
#define LOGI(...) printf("[StorageBridge] "); printf(__VA_ARGS__); printf("\n")
|
|
21
|
+
#define LOGD(...) printf("[StorageBridge DEBUG] "); printf(__VA_ARGS__); printf("\n")
|
|
22
|
+
#define LOGE(...) printf("[StorageBridge ERROR] "); printf(__VA_ARGS__); printf("\n")
|
|
23
|
+
#endif
|
|
24
|
+
|
|
25
|
+
namespace runanywhere {
|
|
26
|
+
namespace bridges {
|
|
27
|
+
|
|
28
|
+
// =============================================================================
|
|
29
|
+
// Static storage for callbacks (needed for C function pointers)
|
|
30
|
+
// =============================================================================
|
|
31
|
+
|
|
32
|
+
static StoragePlatformCallbacks* g_storageCallbacks = nullptr;
|
|
33
|
+
|
|
34
|
+
// =============================================================================
|
|
35
|
+
// C Callback Implementations (called by RACommons)
|
|
36
|
+
// =============================================================================
|
|
37
|
+
|
|
38
|
+
static int64_t storageCalculateDirSizeCallback(const char* path, void* userData) {
|
|
39
|
+
if (!path || !g_storageCallbacks || !g_storageCallbacks->calculateDirSize) {
|
|
40
|
+
return 0;
|
|
41
|
+
}
|
|
42
|
+
return g_storageCallbacks->calculateDirSize(path);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static int64_t storageGetFileSizeCallback(const char* path, void* userData) {
|
|
46
|
+
if (!path || !g_storageCallbacks || !g_storageCallbacks->getFileSize) {
|
|
47
|
+
return -1;
|
|
48
|
+
}
|
|
49
|
+
return g_storageCallbacks->getFileSize(path);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static rac_bool_t storagePathExistsCallback(
|
|
53
|
+
const char* path,
|
|
54
|
+
rac_bool_t* isDirectory,
|
|
55
|
+
void* userData
|
|
56
|
+
) {
|
|
57
|
+
if (!path || !g_storageCallbacks || !g_storageCallbacks->pathExists) {
|
|
58
|
+
return RAC_FALSE;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
auto [exists, isDir] = g_storageCallbacks->pathExists(path);
|
|
62
|
+
if (isDirectory) {
|
|
63
|
+
*isDirectory = isDir ? RAC_TRUE : RAC_FALSE;
|
|
64
|
+
}
|
|
65
|
+
return exists ? RAC_TRUE : RAC_FALSE;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static int64_t storageGetAvailableSpaceCallback(void* userData) {
|
|
69
|
+
if (!g_storageCallbacks || !g_storageCallbacks->getAvailableSpace) {
|
|
70
|
+
return 0;
|
|
71
|
+
}
|
|
72
|
+
return g_storageCallbacks->getAvailableSpace();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
static int64_t storageGetTotalSpaceCallback(void* userData) {
|
|
76
|
+
if (!g_storageCallbacks || !g_storageCallbacks->getTotalSpace) {
|
|
77
|
+
return 0;
|
|
78
|
+
}
|
|
79
|
+
return g_storageCallbacks->getTotalSpace();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// =============================================================================
|
|
83
|
+
// StorageBridge Implementation
|
|
84
|
+
// =============================================================================
|
|
85
|
+
|
|
86
|
+
StorageBridge& StorageBridge::shared() {
|
|
87
|
+
static StorageBridge instance;
|
|
88
|
+
return instance;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
StorageBridge::~StorageBridge() {
|
|
92
|
+
shutdown();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
void StorageBridge::setPlatformCallbacks(const StoragePlatformCallbacks& callbacks) {
|
|
96
|
+
platformCallbacks_ = callbacks;
|
|
97
|
+
|
|
98
|
+
// Store in global for C callbacks
|
|
99
|
+
static StoragePlatformCallbacks storedCallbacks;
|
|
100
|
+
storedCallbacks = callbacks;
|
|
101
|
+
g_storageCallbacks = &storedCallbacks;
|
|
102
|
+
|
|
103
|
+
LOGI("Storage platform callbacks set");
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
rac_result_t StorageBridge::initialize() {
|
|
107
|
+
if (handle_) {
|
|
108
|
+
LOGD("Storage analyzer already initialized");
|
|
109
|
+
return RAC_SUCCESS;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Setup callback struct
|
|
113
|
+
memset(&racCallbacks_, 0, sizeof(racCallbacks_));
|
|
114
|
+
racCallbacks_.calculate_dir_size = storageCalculateDirSizeCallback;
|
|
115
|
+
racCallbacks_.get_file_size = storageGetFileSizeCallback;
|
|
116
|
+
racCallbacks_.path_exists = storagePathExistsCallback;
|
|
117
|
+
racCallbacks_.get_available_space = storageGetAvailableSpaceCallback;
|
|
118
|
+
racCallbacks_.get_total_space = storageGetTotalSpaceCallback;
|
|
119
|
+
racCallbacks_.user_data = nullptr;
|
|
120
|
+
|
|
121
|
+
// Create analyzer
|
|
122
|
+
rac_result_t result = rac_storage_analyzer_create(&racCallbacks_, &handle_);
|
|
123
|
+
|
|
124
|
+
if (result == RAC_SUCCESS) {
|
|
125
|
+
LOGI("Storage analyzer created successfully");
|
|
126
|
+
} else {
|
|
127
|
+
LOGE("Failed to create storage analyzer: %d", result);
|
|
128
|
+
handle_ = nullptr;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return result;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
void StorageBridge::shutdown() {
|
|
135
|
+
if (handle_) {
|
|
136
|
+
rac_storage_analyzer_destroy(handle_);
|
|
137
|
+
handle_ = nullptr;
|
|
138
|
+
LOGI("Storage analyzer destroyed");
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
StorageInfo StorageBridge::analyzeStorage(rac_model_registry_handle_t registryHandle) {
|
|
143
|
+
StorageInfo result;
|
|
144
|
+
|
|
145
|
+
if (!handle_) {
|
|
146
|
+
LOGE("Storage analyzer not initialized");
|
|
147
|
+
return result;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (!registryHandle) {
|
|
151
|
+
LOGE("Model registry handle is null");
|
|
152
|
+
return result;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
rac_storage_info_t cInfo = {};
|
|
156
|
+
rac_result_t status = rac_storage_analyzer_analyze(handle_, registryHandle, &cInfo);
|
|
157
|
+
|
|
158
|
+
if (status != RAC_SUCCESS) {
|
|
159
|
+
LOGE("Storage analysis failed: %d", status);
|
|
160
|
+
return result;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Convert app storage
|
|
164
|
+
result.appStorage.documentsSize = cInfo.app_storage.documents_size;
|
|
165
|
+
result.appStorage.cacheSize = cInfo.app_storage.cache_size;
|
|
166
|
+
result.appStorage.appSupportSize = cInfo.app_storage.app_support_size;
|
|
167
|
+
result.appStorage.totalSize = cInfo.app_storage.total_size;
|
|
168
|
+
|
|
169
|
+
// Convert device storage
|
|
170
|
+
result.deviceStorage.totalSpace = cInfo.device_storage.total_space;
|
|
171
|
+
result.deviceStorage.freeSpace = cInfo.device_storage.free_space;
|
|
172
|
+
result.deviceStorage.usedSpace = cInfo.device_storage.used_space;
|
|
173
|
+
|
|
174
|
+
// Convert model metrics
|
|
175
|
+
if (cInfo.models && cInfo.model_count > 0) {
|
|
176
|
+
for (size_t i = 0; i < cInfo.model_count; i++) {
|
|
177
|
+
const auto& cModel = cInfo.models[i];
|
|
178
|
+
ModelStorageMetrics metrics;
|
|
179
|
+
metrics.modelId = cModel.model_id ? cModel.model_id : "";
|
|
180
|
+
metrics.modelName = cModel.model_name ? cModel.model_name : "";
|
|
181
|
+
metrics.localPath = cModel.local_path ? cModel.local_path : "";
|
|
182
|
+
metrics.sizeOnDisk = cModel.size_on_disk;
|
|
183
|
+
result.models.push_back(metrics);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
result.totalModelsSize = cInfo.total_models_size;
|
|
188
|
+
|
|
189
|
+
// Free C++ result
|
|
190
|
+
rac_storage_info_free(&cInfo);
|
|
191
|
+
|
|
192
|
+
LOGI("Storage analysis complete: %zu models, total size: %lld bytes",
|
|
193
|
+
result.models.size(), static_cast<long long>(result.totalModelsSize));
|
|
194
|
+
|
|
195
|
+
return result;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
std::optional<ModelStorageMetrics> StorageBridge::getModelStorageMetrics(
|
|
199
|
+
rac_model_registry_handle_t registryHandle,
|
|
200
|
+
const std::string& modelId,
|
|
201
|
+
rac_inference_framework_t framework
|
|
202
|
+
) {
|
|
203
|
+
if (!handle_ || !registryHandle) {
|
|
204
|
+
return std::nullopt;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
rac_model_storage_metrics_t cMetrics = {};
|
|
208
|
+
rac_result_t result = rac_storage_analyzer_get_model_metrics(
|
|
209
|
+
handle_, registryHandle, modelId.c_str(), framework, &cMetrics
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
if (result != RAC_SUCCESS) {
|
|
213
|
+
return std::nullopt;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
ModelStorageMetrics metrics;
|
|
217
|
+
metrics.modelId = cMetrics.model_id ? cMetrics.model_id : "";
|
|
218
|
+
metrics.modelName = cMetrics.model_name ? cMetrics.model_name : "";
|
|
219
|
+
metrics.localPath = cMetrics.local_path ? cMetrics.local_path : "";
|
|
220
|
+
metrics.sizeOnDisk = cMetrics.size_on_disk;
|
|
221
|
+
|
|
222
|
+
return metrics;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
StorageAvailability StorageBridge::checkStorageAvailable(int64_t modelSize, double safetyMargin) {
|
|
226
|
+
StorageAvailability result;
|
|
227
|
+
|
|
228
|
+
// Use callbacks directly for synchronous check
|
|
229
|
+
int64_t available = g_storageCallbacks && g_storageCallbacks->getAvailableSpace
|
|
230
|
+
? g_storageCallbacks->getAvailableSpace() : 0;
|
|
231
|
+
|
|
232
|
+
int64_t required = static_cast<int64_t>(static_cast<double>(modelSize) * (1.0 + safetyMargin));
|
|
233
|
+
|
|
234
|
+
result.isAvailable = available > required;
|
|
235
|
+
result.requiredSpace = required;
|
|
236
|
+
result.availableSpace = available;
|
|
237
|
+
result.hasWarning = available < required * 2;
|
|
238
|
+
|
|
239
|
+
if (!result.isAvailable) {
|
|
240
|
+
int64_t shortfall = required - available;
|
|
241
|
+
// Format shortfall in MB
|
|
242
|
+
double shortfallMB = static_cast<double>(shortfall) / (1024.0 * 1024.0);
|
|
243
|
+
result.recommendation = "Need " + std::to_string(static_cast<int>(shortfallMB)) + " MB more space.";
|
|
244
|
+
} else if (result.hasWarning) {
|
|
245
|
+
result.recommendation = "Storage space is getting low.";
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return result;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
int64_t StorageBridge::calculateSize(const std::string& path) {
|
|
252
|
+
if (!handle_) {
|
|
253
|
+
LOGE("Storage analyzer not initialized");
|
|
254
|
+
return -1;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
int64_t size = 0;
|
|
258
|
+
rac_result_t result = rac_storage_analyzer_calculate_size(handle_, path.c_str(), &size);
|
|
259
|
+
|
|
260
|
+
if (result != RAC_SUCCESS) {
|
|
261
|
+
LOGE("Failed to calculate size for %s: %d", path.c_str(), result);
|
|
262
|
+
return -1;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return size;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
} // namespace bridges
|
|
269
|
+
} // namespace runanywhere
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file StorageBridge.hpp
|
|
3
|
+
* @brief C++ bridge for storage operations.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors Swift's CppBridge+Storage.swift pattern:
|
|
6
|
+
* - C++ handles business logic (which models, path calculations, aggregation)
|
|
7
|
+
* - Platform provides file operation callbacks
|
|
8
|
+
*
|
|
9
|
+
* Reference: sdk/runanywhere-swift/Sources/RunAnywhere/Foundation/Bridge/Extensions/CppBridge+Storage.swift
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
#pragma once
|
|
13
|
+
|
|
14
|
+
#include <string>
|
|
15
|
+
#include <vector>
|
|
16
|
+
#include <functional>
|
|
17
|
+
#include <cstdint>
|
|
18
|
+
|
|
19
|
+
#include "rac_types.h"
|
|
20
|
+
#include "rac_storage_analyzer.h"
|
|
21
|
+
#include "rac_model_registry.h"
|
|
22
|
+
|
|
23
|
+
namespace runanywhere {
|
|
24
|
+
namespace bridges {
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* App storage info
|
|
28
|
+
*/
|
|
29
|
+
struct AppStorageInfo {
|
|
30
|
+
int64_t documentsSize = 0;
|
|
31
|
+
int64_t cacheSize = 0;
|
|
32
|
+
int64_t appSupportSize = 0;
|
|
33
|
+
int64_t totalSize = 0;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Device storage info
|
|
38
|
+
*/
|
|
39
|
+
struct DeviceStorageInfo {
|
|
40
|
+
int64_t totalSpace = 0;
|
|
41
|
+
int64_t freeSpace = 0;
|
|
42
|
+
int64_t usedSpace = 0;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Model storage metrics
|
|
47
|
+
*/
|
|
48
|
+
struct ModelStorageMetrics {
|
|
49
|
+
std::string modelId;
|
|
50
|
+
std::string modelName;
|
|
51
|
+
std::string localPath;
|
|
52
|
+
int64_t sizeOnDisk = 0;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Overall storage info
|
|
57
|
+
*/
|
|
58
|
+
struct StorageInfo {
|
|
59
|
+
AppStorageInfo appStorage;
|
|
60
|
+
DeviceStorageInfo deviceStorage;
|
|
61
|
+
std::vector<ModelStorageMetrics> models;
|
|
62
|
+
int64_t totalModelsSize = 0;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Storage availability result
|
|
67
|
+
*/
|
|
68
|
+
struct StorageAvailability {
|
|
69
|
+
bool isAvailable = false;
|
|
70
|
+
int64_t requiredSpace = 0;
|
|
71
|
+
int64_t availableSpace = 0;
|
|
72
|
+
bool hasWarning = false;
|
|
73
|
+
std::string recommendation;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Platform callbacks for storage file operations
|
|
78
|
+
*/
|
|
79
|
+
struct StoragePlatformCallbacks {
|
|
80
|
+
// Calculate directory size
|
|
81
|
+
std::function<int64_t(const std::string& path)> calculateDirSize;
|
|
82
|
+
|
|
83
|
+
// Get file size
|
|
84
|
+
std::function<int64_t(const std::string& path)> getFileSize;
|
|
85
|
+
|
|
86
|
+
// Check if path exists (returns: exists, isDirectory)
|
|
87
|
+
std::function<std::pair<bool, bool>(const std::string& path)> pathExists;
|
|
88
|
+
|
|
89
|
+
// Get available disk space
|
|
90
|
+
std::function<int64_t()> getAvailableSpace;
|
|
91
|
+
|
|
92
|
+
// Get total disk space
|
|
93
|
+
std::function<int64_t()> getTotalSpace;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* StorageBridge - Storage analysis via rac_storage_analyzer_* API
|
|
98
|
+
*
|
|
99
|
+
* Mirrors Swift's CppBridge.Storage pattern:
|
|
100
|
+
* - Handle-based API
|
|
101
|
+
* - Platform provides file callbacks
|
|
102
|
+
* - C++ handles business logic
|
|
103
|
+
*/
|
|
104
|
+
class StorageBridge {
|
|
105
|
+
public:
|
|
106
|
+
/**
|
|
107
|
+
* Get shared instance
|
|
108
|
+
*/
|
|
109
|
+
static StorageBridge& shared();
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Set platform callbacks for file operations
|
|
113
|
+
* Must be called during SDK initialization
|
|
114
|
+
*/
|
|
115
|
+
void setPlatformCallbacks(const StoragePlatformCallbacks& callbacks);
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Initialize the storage analyzer
|
|
119
|
+
* Creates handle with registered callbacks
|
|
120
|
+
*/
|
|
121
|
+
rac_result_t initialize();
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Shutdown and cleanup
|
|
125
|
+
*/
|
|
126
|
+
void shutdown();
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Check if initialized
|
|
130
|
+
*/
|
|
131
|
+
bool isInitialized() const { return handle_ != nullptr; }
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Analyze overall storage
|
|
135
|
+
*
|
|
136
|
+
* @param registryHandle Model registry handle for model enumeration
|
|
137
|
+
* @return Storage info
|
|
138
|
+
*/
|
|
139
|
+
StorageInfo analyzeStorage(rac_model_registry_handle_t registryHandle);
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Get storage metrics for a specific model
|
|
143
|
+
*/
|
|
144
|
+
std::optional<ModelStorageMetrics> getModelStorageMetrics(
|
|
145
|
+
rac_model_registry_handle_t registryHandle,
|
|
146
|
+
const std::string& modelId,
|
|
147
|
+
rac_inference_framework_t framework
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Check if storage is available for a download
|
|
152
|
+
*/
|
|
153
|
+
StorageAvailability checkStorageAvailable(int64_t modelSize, double safetyMargin = 0.1);
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Calculate size at a path
|
|
157
|
+
*/
|
|
158
|
+
int64_t calculateSize(const std::string& path);
|
|
159
|
+
|
|
160
|
+
private:
|
|
161
|
+
StorageBridge() = default;
|
|
162
|
+
~StorageBridge();
|
|
163
|
+
StorageBridge(const StorageBridge&) = delete;
|
|
164
|
+
StorageBridge& operator=(const StorageBridge&) = delete;
|
|
165
|
+
|
|
166
|
+
rac_storage_analyzer_handle_t handle_ = nullptr;
|
|
167
|
+
StoragePlatformCallbacks platformCallbacks_{};
|
|
168
|
+
rac_storage_callbacks_t racCallbacks_{};
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
} // namespace bridges
|
|
172
|
+
} // namespace runanywhere
|