@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,488 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RunAnywhere React Native SDK - Event Bus
|
|
3
|
+
*
|
|
4
|
+
* Central event bus for SDK-wide event distribution.
|
|
5
|
+
* Wraps NativeEventEmitter for cross-platform event handling.
|
|
6
|
+
*
|
|
7
|
+
* Reference: sdk/runanywhere-swift/Sources/RunAnywhere/Public/Events/EventBus.swift
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { NativeEventEmitter, NativeModules } from 'react-native';
|
|
11
|
+
import { SDKLogger } from '../../Foundation/Logging';
|
|
12
|
+
import type {
|
|
13
|
+
AnySDKEvent,
|
|
14
|
+
ComponentInitializationEvent,
|
|
15
|
+
SDKComponent,
|
|
16
|
+
SDKConfigurationEvent,
|
|
17
|
+
SDKDeviceEvent,
|
|
18
|
+
SDKEventListener,
|
|
19
|
+
SDKFrameworkEvent,
|
|
20
|
+
SDKGenerationEvent,
|
|
21
|
+
SDKInitializationEvent,
|
|
22
|
+
SDKModelEvent,
|
|
23
|
+
SDKNetworkEvent,
|
|
24
|
+
SDKPerformanceEvent,
|
|
25
|
+
SDKStorageEvent,
|
|
26
|
+
SDKVoiceEvent,
|
|
27
|
+
UnsubscribeFunction,
|
|
28
|
+
} from '../../types';
|
|
29
|
+
|
|
30
|
+
// Native module reference - accessed lazily in setup() to avoid
|
|
31
|
+
// accessing NativeModules before React Native is fully initialized (bridgeless mode)
|
|
32
|
+
function getRunAnywhereModule() {
|
|
33
|
+
return NativeModules.RunAnywhereModule;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Event name constants matching native modules
|
|
37
|
+
export const NativeEventNames = {
|
|
38
|
+
// Initialization events
|
|
39
|
+
SDK_INITIALIZATION: 'RunAnywhere_SDKInitialization',
|
|
40
|
+
// Configuration events
|
|
41
|
+
SDK_CONFIGURATION: 'RunAnywhere_SDKConfiguration',
|
|
42
|
+
// Generation events
|
|
43
|
+
SDK_GENERATION: 'RunAnywhere_SDKGeneration',
|
|
44
|
+
// Model events
|
|
45
|
+
SDK_MODEL: 'RunAnywhere_SDKModel',
|
|
46
|
+
// Voice events
|
|
47
|
+
SDK_VOICE: 'RunAnywhere_SDKVoice',
|
|
48
|
+
// Performance events
|
|
49
|
+
SDK_PERFORMANCE: 'RunAnywhere_SDKPerformance',
|
|
50
|
+
// Network events
|
|
51
|
+
SDK_NETWORK: 'RunAnywhere_SDKNetwork',
|
|
52
|
+
// Storage events
|
|
53
|
+
SDK_STORAGE: 'RunAnywhere_SDKStorage',
|
|
54
|
+
// Framework events
|
|
55
|
+
SDK_FRAMEWORK: 'RunAnywhere_SDKFramework',
|
|
56
|
+
// Device events
|
|
57
|
+
SDK_DEVICE: 'RunAnywhere_SDKDevice',
|
|
58
|
+
// Component events
|
|
59
|
+
SDK_COMPONENT: 'RunAnywhere_SDKComponent',
|
|
60
|
+
// All events (catch-all)
|
|
61
|
+
SDK_ALL_EVENTS: 'RunAnywhere_AllEvents',
|
|
62
|
+
} as const;
|
|
63
|
+
|
|
64
|
+
type NativeEventName = (typeof NativeEventNames)[keyof typeof NativeEventNames];
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Central event bus for SDK-wide event distribution
|
|
68
|
+
* Thread-safe event bus using React Native's NativeEventEmitter
|
|
69
|
+
*/
|
|
70
|
+
class EventBusImpl {
|
|
71
|
+
private emitter: NativeEventEmitter | null = null;
|
|
72
|
+
private subscriptions: Map<string, Set<SDKEventListener<AnySDKEvent>>> =
|
|
73
|
+
new Map();
|
|
74
|
+
private nativeSubscriptions: Map<NativeEventName, { remove: () => void }> =
|
|
75
|
+
new Map();
|
|
76
|
+
private isSetup = false;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Setup the event bus with the native module
|
|
80
|
+
* Called automatically when first subscription is made
|
|
81
|
+
*/
|
|
82
|
+
private setup(): void {
|
|
83
|
+
if (this.isSetup) return;
|
|
84
|
+
|
|
85
|
+
// Only create NativeEventEmitter if native module exists
|
|
86
|
+
// Access NativeModules lazily to avoid issues with bridgeless mode
|
|
87
|
+
const RunAnywhereModule = getRunAnywhereModule();
|
|
88
|
+
if (RunAnywhereModule) {
|
|
89
|
+
this.emitter = new NativeEventEmitter(RunAnywhereModule);
|
|
90
|
+
|
|
91
|
+
// Subscribe to all native event types
|
|
92
|
+
this.setupNativeListener(NativeEventNames.SDK_INITIALIZATION);
|
|
93
|
+
this.setupNativeListener(NativeEventNames.SDK_CONFIGURATION);
|
|
94
|
+
this.setupNativeListener(NativeEventNames.SDK_GENERATION);
|
|
95
|
+
this.setupNativeListener(NativeEventNames.SDK_MODEL);
|
|
96
|
+
this.setupNativeListener(NativeEventNames.SDK_VOICE);
|
|
97
|
+
this.setupNativeListener(NativeEventNames.SDK_PERFORMANCE);
|
|
98
|
+
this.setupNativeListener(NativeEventNames.SDK_NETWORK);
|
|
99
|
+
this.setupNativeListener(NativeEventNames.SDK_STORAGE);
|
|
100
|
+
this.setupNativeListener(NativeEventNames.SDK_FRAMEWORK);
|
|
101
|
+
this.setupNativeListener(NativeEventNames.SDK_DEVICE);
|
|
102
|
+
this.setupNativeListener(NativeEventNames.SDK_COMPONENT);
|
|
103
|
+
} else {
|
|
104
|
+
SDKLogger.events.warning(
|
|
105
|
+
'Native module not available. Events will only work in development mode.'
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
this.isSetup = true;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Setup a listener for a specific native event type
|
|
114
|
+
*/
|
|
115
|
+
private setupNativeListener(eventName: NativeEventName): void {
|
|
116
|
+
if (!this.emitter) return;
|
|
117
|
+
|
|
118
|
+
const subscription = this.emitter.addListener(
|
|
119
|
+
eventName,
|
|
120
|
+
(event: AnySDKEvent) => {
|
|
121
|
+
this.handleNativeEvent(eventName, event);
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
this.nativeSubscriptions.set(eventName, subscription);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Handle an event from native
|
|
130
|
+
*/
|
|
131
|
+
private handleNativeEvent(
|
|
132
|
+
eventName: NativeEventName,
|
|
133
|
+
event: AnySDKEvent
|
|
134
|
+
): void {
|
|
135
|
+
// Get subscribers for this event type
|
|
136
|
+
const typeSubscribers = this.subscriptions.get(eventName);
|
|
137
|
+
if (typeSubscribers) {
|
|
138
|
+
typeSubscribers.forEach((listener) => {
|
|
139
|
+
try {
|
|
140
|
+
listener(event);
|
|
141
|
+
} catch (error) {
|
|
142
|
+
SDKLogger.events.logError(error as Error, 'Error in event listener');
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Also notify "all events" subscribers
|
|
148
|
+
const allSubscribers = this.subscriptions.get(
|
|
149
|
+
NativeEventNames.SDK_ALL_EVENTS
|
|
150
|
+
);
|
|
151
|
+
if (allSubscribers) {
|
|
152
|
+
allSubscribers.forEach((listener) => {
|
|
153
|
+
try {
|
|
154
|
+
listener(event);
|
|
155
|
+
} catch (error) {
|
|
156
|
+
SDKLogger.events.logError(error as Error, 'Error in event listener');
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Subscribe to events of a specific type
|
|
164
|
+
*/
|
|
165
|
+
private subscribe<T extends AnySDKEvent>(
|
|
166
|
+
eventName: NativeEventName,
|
|
167
|
+
listener: SDKEventListener<T>
|
|
168
|
+
): UnsubscribeFunction {
|
|
169
|
+
this.setup();
|
|
170
|
+
|
|
171
|
+
if (!this.subscriptions.has(eventName)) {
|
|
172
|
+
this.subscriptions.set(eventName, new Set());
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const subscribers = this.subscriptions.get(eventName);
|
|
176
|
+
if (!subscribers) {
|
|
177
|
+
// Should never happen since we just set it above
|
|
178
|
+
return () => {};
|
|
179
|
+
}
|
|
180
|
+
subscribers.add(listener as SDKEventListener<AnySDKEvent>);
|
|
181
|
+
|
|
182
|
+
// Return unsubscribe function
|
|
183
|
+
return () => {
|
|
184
|
+
subscribers.delete(listener as SDKEventListener<AnySDKEvent>);
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// ============================================================================
|
|
189
|
+
// Public Subscription Methods
|
|
190
|
+
// ============================================================================
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Subscribe to all SDK events
|
|
194
|
+
*/
|
|
195
|
+
onAllEvents(handler: SDKEventListener<AnySDKEvent>): UnsubscribeFunction {
|
|
196
|
+
return this.subscribe(NativeEventNames.SDK_ALL_EVENTS, handler);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Subscribe to initialization events
|
|
201
|
+
*/
|
|
202
|
+
onInitialization(
|
|
203
|
+
handler: SDKEventListener<SDKInitializationEvent>
|
|
204
|
+
): UnsubscribeFunction {
|
|
205
|
+
return this.subscribe(NativeEventNames.SDK_INITIALIZATION, handler);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Subscribe to configuration events
|
|
210
|
+
*/
|
|
211
|
+
onConfiguration(
|
|
212
|
+
handler: SDKEventListener<SDKConfigurationEvent>
|
|
213
|
+
): UnsubscribeFunction {
|
|
214
|
+
return this.subscribe(NativeEventNames.SDK_CONFIGURATION, handler);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Subscribe to generation events
|
|
219
|
+
*/
|
|
220
|
+
onGeneration(
|
|
221
|
+
handler: SDKEventListener<SDKGenerationEvent>
|
|
222
|
+
): UnsubscribeFunction {
|
|
223
|
+
return this.subscribe(NativeEventNames.SDK_GENERATION, handler);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Subscribe to model events
|
|
228
|
+
*/
|
|
229
|
+
onModel(handler: SDKEventListener<SDKModelEvent>): UnsubscribeFunction {
|
|
230
|
+
return this.subscribe(NativeEventNames.SDK_MODEL, handler);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Subscribe to voice events
|
|
235
|
+
*/
|
|
236
|
+
onVoice(handler: SDKEventListener<SDKVoiceEvent>): UnsubscribeFunction {
|
|
237
|
+
return this.subscribe(NativeEventNames.SDK_VOICE, handler);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Subscribe to performance events
|
|
242
|
+
*/
|
|
243
|
+
onPerformance(
|
|
244
|
+
handler: SDKEventListener<SDKPerformanceEvent>
|
|
245
|
+
): UnsubscribeFunction {
|
|
246
|
+
return this.subscribe(NativeEventNames.SDK_PERFORMANCE, handler);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Subscribe to network events
|
|
251
|
+
*/
|
|
252
|
+
onNetwork(handler: SDKEventListener<SDKNetworkEvent>): UnsubscribeFunction {
|
|
253
|
+
return this.subscribe(NativeEventNames.SDK_NETWORK, handler);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Subscribe to storage events
|
|
258
|
+
*/
|
|
259
|
+
onStorage(handler: SDKEventListener<SDKStorageEvent>): UnsubscribeFunction {
|
|
260
|
+
return this.subscribe(NativeEventNames.SDK_STORAGE, handler);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Subscribe to framework events
|
|
265
|
+
*/
|
|
266
|
+
onFramework(
|
|
267
|
+
handler: SDKEventListener<SDKFrameworkEvent>
|
|
268
|
+
): UnsubscribeFunction {
|
|
269
|
+
return this.subscribe(NativeEventNames.SDK_FRAMEWORK, handler);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Subscribe to device events
|
|
274
|
+
*/
|
|
275
|
+
onDevice(handler: SDKEventListener<SDKDeviceEvent>): UnsubscribeFunction {
|
|
276
|
+
return this.subscribe(NativeEventNames.SDK_DEVICE, handler);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Subscribe to component initialization events
|
|
281
|
+
*/
|
|
282
|
+
onComponentInitialization(
|
|
283
|
+
handler: SDKEventListener<ComponentInitializationEvent>
|
|
284
|
+
): UnsubscribeFunction {
|
|
285
|
+
return this.subscribe(NativeEventNames.SDK_COMPONENT, handler);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Subscribe to specific component events
|
|
290
|
+
*/
|
|
291
|
+
onComponent(
|
|
292
|
+
component: SDKComponent,
|
|
293
|
+
handler: SDKEventListener<ComponentInitializationEvent>
|
|
294
|
+
): UnsubscribeFunction {
|
|
295
|
+
return this.onComponentInitialization((event) => {
|
|
296
|
+
// Filter by component if event has component property
|
|
297
|
+
if ('component' in event && event.component === component) {
|
|
298
|
+
handler(event);
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// ============================================================================
|
|
304
|
+
// Generic Event Subscription
|
|
305
|
+
// ============================================================================
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Generic typed event subscription
|
|
309
|
+
* Example: events.on('generation', handler)
|
|
310
|
+
*/
|
|
311
|
+
on<T extends AnySDKEvent>(
|
|
312
|
+
eventType:
|
|
313
|
+
| 'initialization'
|
|
314
|
+
| 'configuration'
|
|
315
|
+
| 'generation'
|
|
316
|
+
| 'model'
|
|
317
|
+
| 'voice'
|
|
318
|
+
| 'performance'
|
|
319
|
+
| 'network'
|
|
320
|
+
| 'storage'
|
|
321
|
+
| 'framework'
|
|
322
|
+
| 'device'
|
|
323
|
+
| 'component'
|
|
324
|
+
| 'all',
|
|
325
|
+
handler: SDKEventListener<T>
|
|
326
|
+
): UnsubscribeFunction {
|
|
327
|
+
const eventNameMap: Record<string, NativeEventName> = {
|
|
328
|
+
initialization: NativeEventNames.SDK_INITIALIZATION,
|
|
329
|
+
configuration: NativeEventNames.SDK_CONFIGURATION,
|
|
330
|
+
generation: NativeEventNames.SDK_GENERATION,
|
|
331
|
+
model: NativeEventNames.SDK_MODEL,
|
|
332
|
+
voice: NativeEventNames.SDK_VOICE,
|
|
333
|
+
performance: NativeEventNames.SDK_PERFORMANCE,
|
|
334
|
+
network: NativeEventNames.SDK_NETWORK,
|
|
335
|
+
storage: NativeEventNames.SDK_STORAGE,
|
|
336
|
+
framework: NativeEventNames.SDK_FRAMEWORK,
|
|
337
|
+
device: NativeEventNames.SDK_DEVICE,
|
|
338
|
+
component: NativeEventNames.SDK_COMPONENT,
|
|
339
|
+
all: NativeEventNames.SDK_ALL_EVENTS,
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
const eventName = eventNameMap[eventType];
|
|
343
|
+
if (!eventName) {
|
|
344
|
+
SDKLogger.events.warning(`Unknown event type: ${eventType}`);
|
|
345
|
+
return () => {};
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
return this.subscribe(eventName, handler);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// ============================================================================
|
|
352
|
+
// Publishing (for internal/testing use)
|
|
353
|
+
// ============================================================================
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Publish an event locally (for testing or JS-only events)
|
|
357
|
+
* Note: In production, events come from native modules
|
|
358
|
+
*/
|
|
359
|
+
publish(eventType: string, event: AnySDKEvent): void {
|
|
360
|
+
const eventName = `RunAnywhere_SDK${eventType}` as NativeEventName;
|
|
361
|
+
this.handleNativeEvent(eventName, event);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Emit a model event
|
|
366
|
+
* Helper method for components to emit model-related events
|
|
367
|
+
*/
|
|
368
|
+
emitModel(event: SDKModelEvent): void {
|
|
369
|
+
this.handleNativeEvent(NativeEventNames.SDK_MODEL, event);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Emit a voice event
|
|
374
|
+
* Helper method for components to emit voice-related events
|
|
375
|
+
*/
|
|
376
|
+
emitVoice(event: SDKVoiceEvent): void {
|
|
377
|
+
this.handleNativeEvent(NativeEventNames.SDK_VOICE, event);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Emit a component initialization event
|
|
382
|
+
* Helper method for components to emit initialization-related events
|
|
383
|
+
*/
|
|
384
|
+
emitComponentInitialization(event: ComponentInitializationEvent): void {
|
|
385
|
+
this.handleNativeEvent(NativeEventNames.SDK_COMPONENT, event);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// ============================================================================
|
|
389
|
+
// Cleanup
|
|
390
|
+
// ============================================================================
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Remove all subscriptions
|
|
394
|
+
*/
|
|
395
|
+
removeAllListeners(): void {
|
|
396
|
+
this.subscriptions.clear();
|
|
397
|
+
|
|
398
|
+
// Remove native subscriptions
|
|
399
|
+
this.nativeSubscriptions.forEach((subscription) => {
|
|
400
|
+
subscription.remove();
|
|
401
|
+
});
|
|
402
|
+
this.nativeSubscriptions.clear();
|
|
403
|
+
|
|
404
|
+
this.isSetup = false;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// Singleton instance
|
|
409
|
+
let instance: EventBusImpl | null = null;
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Get the singleton instance of EventBus
|
|
413
|
+
*/
|
|
414
|
+
function getInstance(): EventBusImpl {
|
|
415
|
+
if (!instance) {
|
|
416
|
+
instance = new EventBusImpl();
|
|
417
|
+
}
|
|
418
|
+
return instance;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// Create singleton wrapper with all methods exposed at top level
|
|
422
|
+
const singletonWrapper = {
|
|
423
|
+
getInstance,
|
|
424
|
+
// Proxy all methods from getInstance() for backward compatibility
|
|
425
|
+
get onAllEvents() {
|
|
426
|
+
return getInstance().onAllEvents.bind(getInstance());
|
|
427
|
+
},
|
|
428
|
+
get onInitialization() {
|
|
429
|
+
return getInstance().onInitialization.bind(getInstance());
|
|
430
|
+
},
|
|
431
|
+
get onConfiguration() {
|
|
432
|
+
return getInstance().onConfiguration.bind(getInstance());
|
|
433
|
+
},
|
|
434
|
+
get onGeneration() {
|
|
435
|
+
return getInstance().onGeneration.bind(getInstance());
|
|
436
|
+
},
|
|
437
|
+
get onModel() {
|
|
438
|
+
return getInstance().onModel.bind(getInstance());
|
|
439
|
+
},
|
|
440
|
+
get onVoice() {
|
|
441
|
+
return getInstance().onVoice.bind(getInstance());
|
|
442
|
+
},
|
|
443
|
+
get onPerformance() {
|
|
444
|
+
return getInstance().onPerformance.bind(getInstance());
|
|
445
|
+
},
|
|
446
|
+
get onNetwork() {
|
|
447
|
+
return getInstance().onNetwork.bind(getInstance());
|
|
448
|
+
},
|
|
449
|
+
get onStorage() {
|
|
450
|
+
return getInstance().onStorage.bind(getInstance());
|
|
451
|
+
},
|
|
452
|
+
get onFramework() {
|
|
453
|
+
return getInstance().onFramework.bind(getInstance());
|
|
454
|
+
},
|
|
455
|
+
get onDevice() {
|
|
456
|
+
return getInstance().onDevice.bind(getInstance());
|
|
457
|
+
},
|
|
458
|
+
get onComponentInitialization() {
|
|
459
|
+
return getInstance().onComponentInitialization.bind(getInstance());
|
|
460
|
+
},
|
|
461
|
+
get onComponent() {
|
|
462
|
+
return getInstance().onComponent.bind(getInstance());
|
|
463
|
+
},
|
|
464
|
+
get on() {
|
|
465
|
+
return getInstance().on.bind(getInstance());
|
|
466
|
+
},
|
|
467
|
+
get publish() {
|
|
468
|
+
return getInstance().publish.bind(getInstance());
|
|
469
|
+
},
|
|
470
|
+
get emitModel() {
|
|
471
|
+
return getInstance().emitModel.bind(getInstance());
|
|
472
|
+
},
|
|
473
|
+
get emitVoice() {
|
|
474
|
+
return getInstance().emitVoice.bind(getInstance());
|
|
475
|
+
},
|
|
476
|
+
get emitComponentInitialization() {
|
|
477
|
+
return getInstance().emitComponentInitialization.bind(getInstance());
|
|
478
|
+
},
|
|
479
|
+
get removeAllListeners() {
|
|
480
|
+
return getInstance().removeAllListeners.bind(getInstance());
|
|
481
|
+
},
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
// Export singleton wrapper
|
|
485
|
+
export const EventBus = singletonWrapper;
|
|
486
|
+
|
|
487
|
+
// Export type for the EventBus
|
|
488
|
+
export type { EventBusImpl };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RunAnywhere+Logging.ts
|
|
3
|
+
*
|
|
4
|
+
* Logging extension for RunAnywhere SDK.
|
|
5
|
+
* Matches iOS: RunAnywhere+Logging.swift
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { LogLevel } from '../../Foundation/Logging/Models/LogLevel';
|
|
9
|
+
import type {
|
|
10
|
+
LogEventCallback,
|
|
11
|
+
LogDestination,
|
|
12
|
+
} from '../../Foundation/Logging';
|
|
13
|
+
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// Logging Extension
|
|
16
|
+
// ============================================================================
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Set SDK log level
|
|
20
|
+
* Matches iOS: static func setLogLevel(_ level: LogLevel)
|
|
21
|
+
*/
|
|
22
|
+
export function setLogLevel(level: LogLevel): void {
|
|
23
|
+
const { LoggingManager } = require('../../Foundation/Logging');
|
|
24
|
+
LoggingManager.shared.setLogLevel(level);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Subscribe to all SDK log events
|
|
29
|
+
* Matches iOS pattern of exposing log events publicly.
|
|
30
|
+
*/
|
|
31
|
+
export function onLog(callback: LogEventCallback): () => void {
|
|
32
|
+
const { LoggingManager } = require('../../Foundation/Logging');
|
|
33
|
+
return LoggingManager.shared.onLog(callback);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Add a custom log destination
|
|
38
|
+
* Matches iOS: static func addLogDestination(_ destination: LogDestination)
|
|
39
|
+
*/
|
|
40
|
+
export function addLogDestination(destination: LogDestination): void {
|
|
41
|
+
const { LoggingManager } = require('../../Foundation/Logging');
|
|
42
|
+
LoggingManager.shared.addDestination(destination);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Remove a log destination by identifier
|
|
47
|
+
*/
|
|
48
|
+
export function removeLogDestination(identifier: string): void {
|
|
49
|
+
const { LoggingManager } = require('../../Foundation/Logging');
|
|
50
|
+
LoggingManager.shared.removeDestination(identifier);
|
|
51
|
+
}
|