@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,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file DownloadBridge.hpp
|
|
3
|
+
* @brief C++ bridge for download operations.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors Swift's CppBridge+Download.swift pattern:
|
|
6
|
+
* - Handle-based API via rac_download_manager_*
|
|
7
|
+
* - Platform provides HTTP download implementation
|
|
8
|
+
*
|
|
9
|
+
* Reference: sdk/runanywhere-swift/Sources/RunAnywhere/Foundation/Bridge/Extensions/CppBridge+Download.swift
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
#pragma once
|
|
13
|
+
|
|
14
|
+
#include <string>
|
|
15
|
+
#include <vector>
|
|
16
|
+
#include <functional>
|
|
17
|
+
#include <unordered_map>
|
|
18
|
+
#include <cstdint>
|
|
19
|
+
|
|
20
|
+
#include "rac_types.h"
|
|
21
|
+
#include "rac_download.h"
|
|
22
|
+
|
|
23
|
+
namespace runanywhere {
|
|
24
|
+
namespace bridges {
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Download stage enum matching RAC
|
|
28
|
+
*/
|
|
29
|
+
enum class DownloadStage {
|
|
30
|
+
Downloading = 0,
|
|
31
|
+
Extracting = 1,
|
|
32
|
+
Validating = 2,
|
|
33
|
+
Completed = 3
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Download state enum matching RAC
|
|
38
|
+
*/
|
|
39
|
+
enum class DownloadState {
|
|
40
|
+
Pending = 0,
|
|
41
|
+
Downloading = 1,
|
|
42
|
+
Extracting = 2,
|
|
43
|
+
Retrying = 3,
|
|
44
|
+
Completed = 4,
|
|
45
|
+
Failed = 5,
|
|
46
|
+
Cancelled = 6
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Download progress info
|
|
51
|
+
*/
|
|
52
|
+
struct DownloadProgress {
|
|
53
|
+
DownloadStage stage = DownloadStage::Downloading;
|
|
54
|
+
int64_t bytesDownloaded = 0;
|
|
55
|
+
int64_t totalBytes = 0;
|
|
56
|
+
double stageProgress = 0.0;
|
|
57
|
+
double overallProgress = 0.0;
|
|
58
|
+
DownloadState state = DownloadState::Pending;
|
|
59
|
+
double speed = 0.0; // bytes per second
|
|
60
|
+
double estimatedTimeRemaining = -1.0; // seconds
|
|
61
|
+
int32_t retryAttempt = 0;
|
|
62
|
+
rac_result_t errorCode = RAC_SUCCESS;
|
|
63
|
+
std::string errorMessage;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Download configuration
|
|
68
|
+
*/
|
|
69
|
+
struct DownloadConfig {
|
|
70
|
+
int32_t maxConcurrentDownloads = 1;
|
|
71
|
+
int32_t requestTimeoutSeconds = 60;
|
|
72
|
+
int32_t maxRetryAttempts = 3;
|
|
73
|
+
int32_t retryDelaySeconds = 5;
|
|
74
|
+
bool allowCellular = true;
|
|
75
|
+
bool allowConstrainedNetwork = false;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* DownloadBridge - Download orchestration via rac_download_manager_* API
|
|
80
|
+
*
|
|
81
|
+
* Mirrors Swift's CppBridge.Download pattern:
|
|
82
|
+
* - Handle-based API
|
|
83
|
+
* - Progress callbacks stored and invoked
|
|
84
|
+
* - Platform provides actual HTTP downloads
|
|
85
|
+
*/
|
|
86
|
+
class DownloadBridge {
|
|
87
|
+
public:
|
|
88
|
+
/**
|
|
89
|
+
* Get shared instance
|
|
90
|
+
*/
|
|
91
|
+
static DownloadBridge& shared();
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Initialize the download manager
|
|
95
|
+
* @param config Optional configuration
|
|
96
|
+
*/
|
|
97
|
+
rac_result_t initialize(const DownloadConfig* config = nullptr);
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Shutdown and cleanup
|
|
101
|
+
*/
|
|
102
|
+
void shutdown();
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Check if initialized
|
|
106
|
+
*/
|
|
107
|
+
bool isInitialized() const { return handle_ != nullptr; }
|
|
108
|
+
|
|
109
|
+
// =========================================================================
|
|
110
|
+
// Download Operations
|
|
111
|
+
// =========================================================================
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Start a download task
|
|
115
|
+
*
|
|
116
|
+
* @param modelId Model identifier
|
|
117
|
+
* @param url Download URL
|
|
118
|
+
* @param destinationPath Where to save the file
|
|
119
|
+
* @param requiresExtraction Whether to extract archive after download
|
|
120
|
+
* @param progressHandler Callback for progress updates
|
|
121
|
+
* @return Task ID for tracking, empty on error
|
|
122
|
+
*/
|
|
123
|
+
std::string startDownload(
|
|
124
|
+
const std::string& modelId,
|
|
125
|
+
const std::string& url,
|
|
126
|
+
const std::string& destinationPath,
|
|
127
|
+
bool requiresExtraction,
|
|
128
|
+
std::function<void(const DownloadProgress&)> progressHandler
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Cancel a download task
|
|
133
|
+
*/
|
|
134
|
+
rac_result_t cancelDownload(const std::string& taskId);
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Pause all active downloads
|
|
138
|
+
*/
|
|
139
|
+
rac_result_t pauseAll();
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Resume all paused downloads
|
|
143
|
+
*/
|
|
144
|
+
rac_result_t resumeAll();
|
|
145
|
+
|
|
146
|
+
// =========================================================================
|
|
147
|
+
// Progress Tracking
|
|
148
|
+
// =========================================================================
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Get progress for a task
|
|
152
|
+
*/
|
|
153
|
+
std::optional<DownloadProgress> getProgress(const std::string& taskId);
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Get list of active task IDs
|
|
157
|
+
*/
|
|
158
|
+
std::vector<std::string> getActiveTasks();
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Check if download service is healthy
|
|
162
|
+
*/
|
|
163
|
+
bool isHealthy();
|
|
164
|
+
|
|
165
|
+
// =========================================================================
|
|
166
|
+
// Progress Updates (called by platform HTTP layer)
|
|
167
|
+
// =========================================================================
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Update download progress (called by platform)
|
|
171
|
+
*/
|
|
172
|
+
void updateProgress(const std::string& taskId, int64_t bytesDownloaded, int64_t totalBytes);
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Mark download as complete (called by platform)
|
|
176
|
+
*/
|
|
177
|
+
void markComplete(const std::string& taskId, const std::string& downloadedPath);
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Mark download as failed (called by platform)
|
|
181
|
+
*/
|
|
182
|
+
void markFailed(const std::string& taskId, rac_result_t errorCode, const std::string& errorMessage);
|
|
183
|
+
|
|
184
|
+
private:
|
|
185
|
+
DownloadBridge() = default;
|
|
186
|
+
~DownloadBridge();
|
|
187
|
+
DownloadBridge(const DownloadBridge&) = delete;
|
|
188
|
+
DownloadBridge& operator=(const DownloadBridge&) = delete;
|
|
189
|
+
|
|
190
|
+
static DownloadProgress fromRac(const rac_download_progress_t& cProgress);
|
|
191
|
+
|
|
192
|
+
rac_download_manager_handle_t handle_ = nullptr;
|
|
193
|
+
std::unordered_map<std::string, std::function<void(const DownloadProgress&)>> progressCallbacks_;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
} // namespace bridges
|
|
197
|
+
} // namespace runanywhere
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file EventBridge.cpp
|
|
3
|
+
* @brief C++ bridge for event operations.
|
|
4
|
+
*
|
|
5
|
+
* Simplified event bridge that manages event callbacks locally.
|
|
6
|
+
* Does not depend on RACommons event functions (which may not be exported).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
#include "EventBridge.hpp"
|
|
10
|
+
#include <chrono>
|
|
11
|
+
|
|
12
|
+
// Platform-specific logging
|
|
13
|
+
#if defined(ANDROID) || defined(__ANDROID__)
|
|
14
|
+
#include <android/log.h>
|
|
15
|
+
#define LOG_TAG "EventBridge"
|
|
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("[EventBridge] "); printf(__VA_ARGS__); printf("\n")
|
|
22
|
+
#define LOGD(...) printf("[EventBridge DEBUG] "); printf(__VA_ARGS__); printf("\n")
|
|
23
|
+
#define LOGE(...) printf("[EventBridge ERROR] "); printf(__VA_ARGS__); printf("\n")
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace runanywhere {
|
|
27
|
+
namespace bridges {
|
|
28
|
+
|
|
29
|
+
// =============================================================================
|
|
30
|
+
// EventBridge Implementation
|
|
31
|
+
// =============================================================================
|
|
32
|
+
|
|
33
|
+
EventBridge& EventBridge::shared() {
|
|
34
|
+
static EventBridge instance;
|
|
35
|
+
return instance;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
EventBridge::~EventBridge() {
|
|
39
|
+
unregisterFromEvents();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
void EventBridge::setEventCallback(EventCallback callback) {
|
|
43
|
+
eventCallback_ = callback;
|
|
44
|
+
LOGI("Event callback registered");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
void EventBridge::registerForEvents() {
|
|
48
|
+
if (isRegistered_) {
|
|
49
|
+
LOGD("Already registered for events");
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
isRegistered_ = true;
|
|
54
|
+
LOGI("Event registration enabled");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
void EventBridge::unregisterFromEvents() {
|
|
58
|
+
if (!isRegistered_) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
isRegistered_ = false;
|
|
63
|
+
LOGI("Event registration disabled");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
rac_result_t EventBridge::trackEvent(
|
|
67
|
+
const std::string& type,
|
|
68
|
+
EventCategory category,
|
|
69
|
+
EventDestination destination,
|
|
70
|
+
const std::string& propertiesJson
|
|
71
|
+
) {
|
|
72
|
+
LOGD("trackEvent: type=%s category=%d", type.c_str(), static_cast<int>(category));
|
|
73
|
+
|
|
74
|
+
// If we have a callback registered, forward the event
|
|
75
|
+
if (eventCallback_) {
|
|
76
|
+
SDKEvent event;
|
|
77
|
+
auto now = std::chrono::system_clock::now();
|
|
78
|
+
auto millis = std::chrono::duration_cast<std::chrono::milliseconds>(
|
|
79
|
+
now.time_since_epoch()).count();
|
|
80
|
+
|
|
81
|
+
event.id = std::to_string(millis);
|
|
82
|
+
event.type = type;
|
|
83
|
+
event.category = category;
|
|
84
|
+
event.timestampMs = millis;
|
|
85
|
+
event.destination = destination;
|
|
86
|
+
event.propertiesJson = propertiesJson;
|
|
87
|
+
|
|
88
|
+
eventCallback_(event);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return RAC_SUCCESS;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
rac_result_t EventBridge::publishEvent(const SDKEvent& event) {
|
|
95
|
+
LOGD("publishEvent: type=%s", event.type.c_str());
|
|
96
|
+
|
|
97
|
+
// If we have a callback registered, forward the event
|
|
98
|
+
if (eventCallback_) {
|
|
99
|
+
eventCallback_(event);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return RAC_SUCCESS;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
std::string EventBridge::getCategoryName(EventCategory category) {
|
|
106
|
+
switch (category) {
|
|
107
|
+
case EventCategory::SDK: return "sdk";
|
|
108
|
+
case EventCategory::Model: return "model";
|
|
109
|
+
case EventCategory::LLM: return "llm";
|
|
110
|
+
case EventCategory::STT: return "stt";
|
|
111
|
+
case EventCategory::TTS: return "tts";
|
|
112
|
+
case EventCategory::Voice: return "voice";
|
|
113
|
+
case EventCategory::Storage: return "storage";
|
|
114
|
+
case EventCategory::Device: return "device";
|
|
115
|
+
case EventCategory::Network: return "network";
|
|
116
|
+
case EventCategory::Error: return "error";
|
|
117
|
+
case EventCategory::Analytics: return "analytics";
|
|
118
|
+
case EventCategory::Performance: return "performance";
|
|
119
|
+
case EventCategory::User: return "user";
|
|
120
|
+
default: return "unknown";
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
} // namespace bridges
|
|
125
|
+
} // namespace runanywhere
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file EventBridge.hpp
|
|
3
|
+
* @brief C++ bridge for event operations.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors Swift's event handling pattern:
|
|
6
|
+
* - Subscribe to events via rac_event_subscribe()
|
|
7
|
+
* - Forward events to JS layer
|
|
8
|
+
*
|
|
9
|
+
* Reference: sdk/runanywhere-swift/Sources/RunAnywhere/Infrastructure/Events/
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
#pragma once
|
|
13
|
+
|
|
14
|
+
#include <string>
|
|
15
|
+
#include <functional>
|
|
16
|
+
#include <vector>
|
|
17
|
+
#include <cstdint>
|
|
18
|
+
|
|
19
|
+
#include "rac_types.h"
|
|
20
|
+
|
|
21
|
+
namespace runanywhere {
|
|
22
|
+
namespace bridges {
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Event category enum matching RAC
|
|
26
|
+
*/
|
|
27
|
+
enum class EventCategory {
|
|
28
|
+
SDK = 0,
|
|
29
|
+
Model = 1,
|
|
30
|
+
LLM = 2,
|
|
31
|
+
STT = 3,
|
|
32
|
+
TTS = 4,
|
|
33
|
+
Voice = 5,
|
|
34
|
+
Storage = 6,
|
|
35
|
+
Device = 7,
|
|
36
|
+
Network = 8,
|
|
37
|
+
Error = 9,
|
|
38
|
+
Analytics = 10,
|
|
39
|
+
Performance = 11,
|
|
40
|
+
User = 12
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Event destination enum matching RAC
|
|
45
|
+
*/
|
|
46
|
+
enum class EventDestination {
|
|
47
|
+
PublicOnly = 0,
|
|
48
|
+
AnalyticsOnly = 1,
|
|
49
|
+
All = 2
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Event data structure
|
|
54
|
+
*/
|
|
55
|
+
struct SDKEvent {
|
|
56
|
+
std::string id;
|
|
57
|
+
std::string type;
|
|
58
|
+
EventCategory category = EventCategory::SDK;
|
|
59
|
+
int64_t timestampMs = 0;
|
|
60
|
+
std::string sessionId;
|
|
61
|
+
EventDestination destination = EventDestination::All;
|
|
62
|
+
std::string propertiesJson;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Event callback type
|
|
67
|
+
*/
|
|
68
|
+
using EventCallback = std::function<void(const SDKEvent&)>;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* EventBridge - Event subscription and publishing
|
|
72
|
+
*
|
|
73
|
+
* Mirrors Swift's EventBridge pattern:
|
|
74
|
+
* - Subscribe to C++ events
|
|
75
|
+
* - Forward to JS layer
|
|
76
|
+
* - Track events via rac_event_track()
|
|
77
|
+
*/
|
|
78
|
+
class EventBridge {
|
|
79
|
+
public:
|
|
80
|
+
/**
|
|
81
|
+
* Get shared instance
|
|
82
|
+
*/
|
|
83
|
+
static EventBridge& shared();
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Register event callback for JS layer
|
|
87
|
+
* Events will be forwarded to this callback
|
|
88
|
+
*/
|
|
89
|
+
void setEventCallback(EventCallback callback);
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Register with RACommons to receive events
|
|
93
|
+
* Must be called during SDK initialization
|
|
94
|
+
*/
|
|
95
|
+
void registerForEvents();
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Unregister from RACommons events
|
|
99
|
+
*/
|
|
100
|
+
void unregisterFromEvents();
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Track an event
|
|
104
|
+
*
|
|
105
|
+
* @param type Event type string
|
|
106
|
+
* @param category Event category
|
|
107
|
+
* @param destination Where to route this event
|
|
108
|
+
* @param propertiesJson Event properties as JSON
|
|
109
|
+
*/
|
|
110
|
+
rac_result_t trackEvent(
|
|
111
|
+
const std::string& type,
|
|
112
|
+
EventCategory category,
|
|
113
|
+
EventDestination destination,
|
|
114
|
+
const std::string& propertiesJson
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Publish an event
|
|
119
|
+
*/
|
|
120
|
+
rac_result_t publishEvent(const SDKEvent& event);
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Get category name
|
|
124
|
+
*/
|
|
125
|
+
static std::string getCategoryName(EventCategory category);
|
|
126
|
+
|
|
127
|
+
private:
|
|
128
|
+
EventBridge() = default;
|
|
129
|
+
~EventBridge();
|
|
130
|
+
EventBridge(const EventBridge&) = delete;
|
|
131
|
+
EventBridge& operator=(const EventBridge&) = delete;
|
|
132
|
+
|
|
133
|
+
EventCallback eventCallback_;
|
|
134
|
+
uint64_t subscriptionId_ = 0;
|
|
135
|
+
bool isRegistered_ = false;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
} // namespace bridges
|
|
139
|
+
} // namespace runanywhere
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file HTTPBridge.cpp
|
|
3
|
+
* @brief HTTP bridge implementation
|
|
4
|
+
*
|
|
5
|
+
* NOTE: HTTP is handled by the JS layer. This bridge manages configuration.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#include "HTTPBridge.hpp"
|
|
9
|
+
|
|
10
|
+
// Platform-specific logging
|
|
11
|
+
#if defined(ANDROID) || defined(__ANDROID__)
|
|
12
|
+
#include <android/log.h>
|
|
13
|
+
#define LOG_TAG "HTTPBridge"
|
|
14
|
+
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
|
|
15
|
+
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
|
|
16
|
+
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
|
|
17
|
+
#else
|
|
18
|
+
#include <cstdio>
|
|
19
|
+
#define LOGI(...) printf("[HTTPBridge] "); printf(__VA_ARGS__); printf("\n")
|
|
20
|
+
#define LOGD(...) printf("[HTTPBridge DEBUG] "); printf(__VA_ARGS__); printf("\n")
|
|
21
|
+
#define LOGE(...) printf("[HTTPBridge ERROR] "); printf(__VA_ARGS__); printf("\n")
|
|
22
|
+
#endif
|
|
23
|
+
|
|
24
|
+
namespace runanywhere {
|
|
25
|
+
namespace bridges {
|
|
26
|
+
|
|
27
|
+
HTTPBridge& HTTPBridge::shared() {
|
|
28
|
+
static HTTPBridge instance;
|
|
29
|
+
return instance;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
void HTTPBridge::configure(const std::string& baseURL, const std::string& apiKey) {
|
|
33
|
+
baseURL_ = baseURL;
|
|
34
|
+
apiKey_ = apiKey;
|
|
35
|
+
configured_ = true;
|
|
36
|
+
|
|
37
|
+
LOGI("HTTP configured: baseURL=%s", baseURL.c_str());
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
void HTTPBridge::setAuthorizationToken(const std::string& token) {
|
|
41
|
+
authToken_ = token;
|
|
42
|
+
LOGD("Authorization token set");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
std::optional<std::string> HTTPBridge::getAuthorizationToken() const {
|
|
46
|
+
return authToken_;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
void HTTPBridge::clearAuthorizationToken() {
|
|
50
|
+
authToken_.reset();
|
|
51
|
+
LOGD("Authorization token cleared");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
void HTTPBridge::setHTTPExecutor(HTTPExecutor executor) {
|
|
55
|
+
executor_ = executor;
|
|
56
|
+
LOGI("HTTP executor registered");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
std::optional<HTTPResponse> HTTPBridge::execute(
|
|
60
|
+
const std::string& method,
|
|
61
|
+
const std::string& endpoint,
|
|
62
|
+
const std::string& body,
|
|
63
|
+
bool requiresAuth
|
|
64
|
+
) {
|
|
65
|
+
if (!executor_) {
|
|
66
|
+
LOGE("No HTTP executor registered - HTTP requests must go through JS layer");
|
|
67
|
+
return std::nullopt;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
std::string url = buildURL(endpoint);
|
|
71
|
+
LOGD("Executing %s %s", method.c_str(), url.c_str());
|
|
72
|
+
|
|
73
|
+
return executor_(method, url, body, requiresAuth);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
std::string HTTPBridge::buildURL(const std::string& endpoint) const {
|
|
77
|
+
if (baseURL_.empty()) {
|
|
78
|
+
return endpoint;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Ensure proper URL joining
|
|
82
|
+
std::string url = baseURL_;
|
|
83
|
+
if (!url.empty() && url.back() == '/') {
|
|
84
|
+
url.pop_back();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (!endpoint.empty() && endpoint.front() != '/') {
|
|
88
|
+
url += '/';
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
url += endpoint;
|
|
92
|
+
return url;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
} // namespace bridges
|
|
96
|
+
} // namespace runanywhere
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file HTTPBridge.hpp
|
|
3
|
+
* @brief HTTP bridge documentation
|
|
4
|
+
*
|
|
5
|
+
* NOTE: HTTP is handled entirely by the JavaScript/platform layer.
|
|
6
|
+
*
|
|
7
|
+
* In Swift, HTTPService.swift handles all HTTP requests.
|
|
8
|
+
* In React Native, the JS layer (HTTPService.ts) handles HTTP.
|
|
9
|
+
*
|
|
10
|
+
* C++ does NOT make HTTP requests directly. Instead:
|
|
11
|
+
* 1. C++ provides JSON building functions (rac_auth_request_to_json, etc.)
|
|
12
|
+
* 2. JS layer makes the HTTP request
|
|
13
|
+
* 3. C++ parses the response (rac_auth_response_from_json, etc.)
|
|
14
|
+
* 4. C++ stores state (rac_state_set_auth, etc.)
|
|
15
|
+
*
|
|
16
|
+
* This bridge provides:
|
|
17
|
+
* - Configuration storage (base URL, API key)
|
|
18
|
+
* - Authorization header management
|
|
19
|
+
* - HTTP executor registration (for C++ components that need to make requests)
|
|
20
|
+
*
|
|
21
|
+
* Reference: sdk/runanywhere-swift/Sources/RunAnywhere/Foundation/Bridge/Extensions/CppBridge+HTTP.swift
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
#pragma once
|
|
25
|
+
|
|
26
|
+
#include <string>
|
|
27
|
+
#include <functional>
|
|
28
|
+
#include <optional>
|
|
29
|
+
|
|
30
|
+
#include "rac_types.h"
|
|
31
|
+
#include "rac_http_client.h"
|
|
32
|
+
|
|
33
|
+
namespace runanywhere {
|
|
34
|
+
namespace bridges {
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* HTTP response
|
|
38
|
+
*/
|
|
39
|
+
struct HTTPResponse {
|
|
40
|
+
int32_t statusCode = 0;
|
|
41
|
+
std::string body;
|
|
42
|
+
std::string error;
|
|
43
|
+
bool success = false;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* HTTP executor callback type
|
|
48
|
+
* Platform provides this to handle HTTP requests
|
|
49
|
+
*/
|
|
50
|
+
using HTTPExecutor = std::function<HTTPResponse(
|
|
51
|
+
const std::string& method,
|
|
52
|
+
const std::string& url,
|
|
53
|
+
const std::string& body,
|
|
54
|
+
bool requiresAuth
|
|
55
|
+
)>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* HTTPBridge - HTTP configuration and executor registration
|
|
59
|
+
*
|
|
60
|
+
* NOTE: Actual HTTP requests are made by the JS layer, not C++.
|
|
61
|
+
* This bridge handles configuration and provides an executor for
|
|
62
|
+
* C++ components that need HTTP access.
|
|
63
|
+
*/
|
|
64
|
+
class HTTPBridge {
|
|
65
|
+
public:
|
|
66
|
+
/**
|
|
67
|
+
* Get shared instance
|
|
68
|
+
*/
|
|
69
|
+
static HTTPBridge& shared();
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Configure HTTP with base URL and API key
|
|
73
|
+
*/
|
|
74
|
+
void configure(const std::string& baseURL, const std::string& apiKey);
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Check if configured
|
|
78
|
+
*/
|
|
79
|
+
bool isConfigured() const { return configured_; }
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Get base URL
|
|
83
|
+
*/
|
|
84
|
+
const std::string& getBaseURL() const { return baseURL_; }
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Get API key
|
|
88
|
+
*/
|
|
89
|
+
const std::string& getAPIKey() const { return apiKey_; }
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Set authorization token
|
|
93
|
+
*/
|
|
94
|
+
void setAuthorizationToken(const std::string& token);
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Get authorization token
|
|
98
|
+
*/
|
|
99
|
+
std::optional<std::string> getAuthorizationToken() const;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Clear authorization token
|
|
103
|
+
*/
|
|
104
|
+
void clearAuthorizationToken();
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Register HTTP executor (called by platform)
|
|
108
|
+
*
|
|
109
|
+
* This allows C++ components to make HTTP requests through the platform.
|
|
110
|
+
* The platform handles the actual network operations.
|
|
111
|
+
*/
|
|
112
|
+
void setHTTPExecutor(HTTPExecutor executor);
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Execute HTTP request via registered executor
|
|
116
|
+
* Returns nullopt if no executor registered
|
|
117
|
+
*/
|
|
118
|
+
std::optional<HTTPResponse> execute(
|
|
119
|
+
const std::string& method,
|
|
120
|
+
const std::string& endpoint,
|
|
121
|
+
const std::string& body,
|
|
122
|
+
bool requiresAuth
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Build full URL from endpoint
|
|
127
|
+
*/
|
|
128
|
+
std::string buildURL(const std::string& endpoint) const;
|
|
129
|
+
|
|
130
|
+
private:
|
|
131
|
+
HTTPBridge() = default;
|
|
132
|
+
~HTTPBridge() = default;
|
|
133
|
+
HTTPBridge(const HTTPBridge&) = delete;
|
|
134
|
+
HTTPBridge& operator=(const HTTPBridge&) = delete;
|
|
135
|
+
|
|
136
|
+
bool configured_ = false;
|
|
137
|
+
std::string baseURL_;
|
|
138
|
+
std::string apiKey_;
|
|
139
|
+
std::optional<std::string> authToken_;
|
|
140
|
+
HTTPExecutor executor_;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
} // namespace bridges
|
|
144
|
+
} // namespace runanywhere
|