@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,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Foundation/ErrorTypes
|
|
3
|
+
*
|
|
4
|
+
* Unified error handling system for the SDK.
|
|
5
|
+
* Matches iOS SDK: Foundation/ErrorTypes/
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// Error codes
|
|
9
|
+
export { ErrorCode, getErrorCodeMessage } from './ErrorCodes';
|
|
10
|
+
|
|
11
|
+
// Error categories
|
|
12
|
+
export {
|
|
13
|
+
ErrorCategory,
|
|
14
|
+
allErrorCategories,
|
|
15
|
+
getCategoryFromCode,
|
|
16
|
+
inferCategoryFromError,
|
|
17
|
+
} from './ErrorCategory';
|
|
18
|
+
|
|
19
|
+
// Error context - Type exports
|
|
20
|
+
export type { ErrorContext } from './ErrorContext';
|
|
21
|
+
|
|
22
|
+
// Error context - Value exports
|
|
23
|
+
export {
|
|
24
|
+
createErrorContext,
|
|
25
|
+
formatStackTrace,
|
|
26
|
+
formatLocation,
|
|
27
|
+
formatContext,
|
|
28
|
+
ContextualError,
|
|
29
|
+
withContext,
|
|
30
|
+
getErrorContext,
|
|
31
|
+
getUnderlyingError,
|
|
32
|
+
} from './ErrorContext';
|
|
33
|
+
|
|
34
|
+
// SDK Error - Type exports
|
|
35
|
+
export type { SDKErrorProtocol } from './SDKError';
|
|
36
|
+
|
|
37
|
+
// SDK Error - Value exports
|
|
38
|
+
export {
|
|
39
|
+
// Legacy enum (backwards compatibility)
|
|
40
|
+
SDKErrorCode,
|
|
41
|
+
// Class
|
|
42
|
+
SDKError,
|
|
43
|
+
// Utility functions
|
|
44
|
+
asSDKError,
|
|
45
|
+
isSDKError,
|
|
46
|
+
captureAndThrow,
|
|
47
|
+
// Convenience factory functions
|
|
48
|
+
notInitializedError,
|
|
49
|
+
alreadyInitializedError,
|
|
50
|
+
invalidInputError,
|
|
51
|
+
modelNotFoundError,
|
|
52
|
+
modelLoadError,
|
|
53
|
+
networkError,
|
|
54
|
+
authenticationError,
|
|
55
|
+
generationError,
|
|
56
|
+
storageError,
|
|
57
|
+
} from './SDKError';
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initialization Phase
|
|
3
|
+
*
|
|
4
|
+
* Represents the two-phase initialization pattern matching iOS SDK.
|
|
5
|
+
*
|
|
6
|
+
* Reference: sdk/runanywhere-swift/Sources/RunAnywhere/Public/RunAnywhere.swift
|
|
7
|
+
*
|
|
8
|
+
* Phase 1 (Core): Synchronous, fast (~1-5ms)
|
|
9
|
+
* - Validate configuration
|
|
10
|
+
* - Setup logging
|
|
11
|
+
* - Store parameters
|
|
12
|
+
* - No network calls
|
|
13
|
+
*
|
|
14
|
+
* Phase 2 (Services): Asynchronous (~100-500ms)
|
|
15
|
+
* - Initialize network services
|
|
16
|
+
* - Setup authentication
|
|
17
|
+
* - Load models
|
|
18
|
+
* - Register device
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The current initialization phase of the SDK
|
|
23
|
+
*/
|
|
24
|
+
export enum InitializationPhase {
|
|
25
|
+
/**
|
|
26
|
+
* SDK has not been initialized
|
|
27
|
+
*/
|
|
28
|
+
NotInitialized = 'notInitialized',
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Phase 1 complete: Core initialized (sync)
|
|
32
|
+
* - Configuration validated
|
|
33
|
+
* - Logging setup
|
|
34
|
+
* - Parameters stored
|
|
35
|
+
* - SDK is usable for basic operations
|
|
36
|
+
*/
|
|
37
|
+
CoreInitialized = 'coreInitialized',
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Phase 2 in progress: Services initializing (async)
|
|
41
|
+
* - Network services starting
|
|
42
|
+
* - Authentication in progress
|
|
43
|
+
* - Models loading
|
|
44
|
+
*/
|
|
45
|
+
ServicesInitializing = 'servicesInitializing',
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Phase 2 complete: All services ready
|
|
49
|
+
* - Network ready
|
|
50
|
+
* - Authenticated (if required)
|
|
51
|
+
* - Models loaded
|
|
52
|
+
* - Device registered
|
|
53
|
+
*/
|
|
54
|
+
FullyInitialized = 'fullyInitialized',
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Initialization failed
|
|
58
|
+
*/
|
|
59
|
+
Failed = 'failed',
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Check if a phase indicates the SDK is usable
|
|
64
|
+
*/
|
|
65
|
+
export function isSDKUsable(phase: InitializationPhase): boolean {
|
|
66
|
+
return (
|
|
67
|
+
phase === InitializationPhase.CoreInitialized ||
|
|
68
|
+
phase === InitializationPhase.ServicesInitializing ||
|
|
69
|
+
phase === InitializationPhase.FullyInitialized
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Check if a phase indicates services are ready
|
|
75
|
+
*/
|
|
76
|
+
export function areServicesReady(phase: InitializationPhase): boolean {
|
|
77
|
+
return phase === InitializationPhase.FullyInitialized;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Check if initialization is in progress
|
|
82
|
+
*/
|
|
83
|
+
export function isInitializing(phase: InitializationPhase): boolean {
|
|
84
|
+
return phase === InitializationPhase.ServicesInitializing;
|
|
85
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initialization State
|
|
3
|
+
*
|
|
4
|
+
* Tracks the complete initialization state of the SDK.
|
|
5
|
+
* Matches iOS SDK state tracking pattern.
|
|
6
|
+
*
|
|
7
|
+
* Reference: sdk/runanywhere-swift/Sources/RunAnywhere/Public/RunAnywhere.swift
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { InitializationPhase } from './InitializationPhase';
|
|
11
|
+
import type { SDKEnvironment } from '../../types';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Parameters passed to SDK initialization
|
|
15
|
+
* Matches iOS SDKInitParams
|
|
16
|
+
*/
|
|
17
|
+
export interface SDKInitParams {
|
|
18
|
+
/**
|
|
19
|
+
* API key for backend authentication
|
|
20
|
+
*/
|
|
21
|
+
apiKey?: string;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Base URL for API calls
|
|
25
|
+
*/
|
|
26
|
+
baseURL?: string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* SDK environment (development, staging, production)
|
|
30
|
+
*/
|
|
31
|
+
environment: SDKEnvironment;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Complete initialization state of the SDK
|
|
36
|
+
*/
|
|
37
|
+
export interface InitializationState {
|
|
38
|
+
/**
|
|
39
|
+
* Current initialization phase
|
|
40
|
+
*/
|
|
41
|
+
phase: InitializationPhase;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Whether Phase 1 (core) initialization is complete
|
|
45
|
+
* Equivalent to iOS: isInitialized
|
|
46
|
+
*/
|
|
47
|
+
isCoreInitialized: boolean;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Whether Phase 2 (services) initialization is complete
|
|
51
|
+
* Equivalent to iOS: hasCompletedServicesInit
|
|
52
|
+
*/
|
|
53
|
+
hasCompletedServicesInit: boolean;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Current SDK environment
|
|
57
|
+
*/
|
|
58
|
+
environment: SDKEnvironment | null;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Stored initialization parameters
|
|
62
|
+
*/
|
|
63
|
+
initParams: SDKInitParams | null;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Backend type in use (e.g., 'llamacpp', 'onnx')
|
|
67
|
+
*/
|
|
68
|
+
backendType: string | null;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Error if initialization failed
|
|
72
|
+
*/
|
|
73
|
+
error: Error | null;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Timestamp when Phase 1 completed
|
|
77
|
+
*/
|
|
78
|
+
coreInitTimestamp: number | null;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Timestamp when Phase 2 completed
|
|
82
|
+
*/
|
|
83
|
+
servicesInitTimestamp: number | null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Create initial (not initialized) state
|
|
88
|
+
*/
|
|
89
|
+
export function createInitialState(): InitializationState {
|
|
90
|
+
return {
|
|
91
|
+
phase: InitializationPhase.NotInitialized,
|
|
92
|
+
isCoreInitialized: false,
|
|
93
|
+
hasCompletedServicesInit: false,
|
|
94
|
+
environment: null,
|
|
95
|
+
initParams: null,
|
|
96
|
+
backendType: null,
|
|
97
|
+
error: null,
|
|
98
|
+
coreInitTimestamp: null,
|
|
99
|
+
servicesInitTimestamp: null,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Update state to Phase 1 complete
|
|
105
|
+
*/
|
|
106
|
+
export function markCoreInitialized(
|
|
107
|
+
state: InitializationState,
|
|
108
|
+
params: SDKInitParams,
|
|
109
|
+
backendType: string | null
|
|
110
|
+
): InitializationState {
|
|
111
|
+
return {
|
|
112
|
+
...state,
|
|
113
|
+
phase: InitializationPhase.CoreInitialized,
|
|
114
|
+
isCoreInitialized: true,
|
|
115
|
+
environment: params.environment,
|
|
116
|
+
initParams: params,
|
|
117
|
+
backendType,
|
|
118
|
+
coreInitTimestamp: Date.now(),
|
|
119
|
+
error: null,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Update state to Phase 2 in progress
|
|
125
|
+
*/
|
|
126
|
+
export function markServicesInitializing(
|
|
127
|
+
state: InitializationState
|
|
128
|
+
): InitializationState {
|
|
129
|
+
return {
|
|
130
|
+
...state,
|
|
131
|
+
phase: InitializationPhase.ServicesInitializing,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Update state to Phase 2 complete
|
|
137
|
+
*/
|
|
138
|
+
export function markServicesInitialized(
|
|
139
|
+
state: InitializationState
|
|
140
|
+
): InitializationState {
|
|
141
|
+
return {
|
|
142
|
+
...state,
|
|
143
|
+
phase: InitializationPhase.FullyInitialized,
|
|
144
|
+
hasCompletedServicesInit: true,
|
|
145
|
+
servicesInitTimestamp: Date.now(),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Update state to failed
|
|
151
|
+
*/
|
|
152
|
+
export function markInitializationFailed(
|
|
153
|
+
state: InitializationState,
|
|
154
|
+
error: Error
|
|
155
|
+
): InitializationState {
|
|
156
|
+
return {
|
|
157
|
+
...state,
|
|
158
|
+
phase: InitializationPhase.Failed,
|
|
159
|
+
error,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Reset state to initial
|
|
165
|
+
*/
|
|
166
|
+
export function resetState(): InitializationState {
|
|
167
|
+
return createInitialState();
|
|
168
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initialization Module
|
|
3
|
+
*
|
|
4
|
+
* Types and utilities for SDK two-phase initialization.
|
|
5
|
+
* Matches iOS SDK pattern.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
InitializationPhase,
|
|
10
|
+
isSDKUsable,
|
|
11
|
+
areServicesReady,
|
|
12
|
+
isInitializing,
|
|
13
|
+
} from './InitializationPhase';
|
|
14
|
+
|
|
15
|
+
// Type exports
|
|
16
|
+
export type { SDKInitParams, InitializationState } from './InitializationState';
|
|
17
|
+
|
|
18
|
+
// Value exports
|
|
19
|
+
export {
|
|
20
|
+
createInitialState,
|
|
21
|
+
markCoreInitialized,
|
|
22
|
+
markServicesInitializing,
|
|
23
|
+
markServicesInitialized,
|
|
24
|
+
markInitializationFailed,
|
|
25
|
+
resetState,
|
|
26
|
+
} from './InitializationState';
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NativeLogBridge.ts
|
|
3
|
+
*
|
|
4
|
+
* Bridge for receiving native logs (iOS/Android) in TypeScript.
|
|
5
|
+
* Native SDKLoggers forward logs through this bridge to the TypeScript LoggingManager.
|
|
6
|
+
*
|
|
7
|
+
* This enables:
|
|
8
|
+
* - Unified log handling across native and TypeScript
|
|
9
|
+
* - All native logs flowing through TypeScript destinations (Sentry, etc.)
|
|
10
|
+
* - Centralized log configuration
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* import { NativeLogBridge } from '@runanywhere/core';
|
|
14
|
+
*
|
|
15
|
+
* // Initialize bridge (call once at app startup)
|
|
16
|
+
* NativeLogBridge.initialize();
|
|
17
|
+
*
|
|
18
|
+
* // Native logs will now flow to TypeScript LoggingManager
|
|
19
|
+
* // and all registered destinations (Console, Sentry, etc.)
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { LoggingManager, type LogEntry } from '../Services/LoggingManager';
|
|
23
|
+
import { LogLevel } from '../Models/LogLevel';
|
|
24
|
+
|
|
25
|
+
// ============================================================================
|
|
26
|
+
// Native Log Entry Interface
|
|
27
|
+
// ============================================================================
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Native log entry structure (from iOS/Android)
|
|
31
|
+
* Matches NativeLogEntry in iOS/Android SDKLogger
|
|
32
|
+
*/
|
|
33
|
+
export interface NativeLogEntryData {
|
|
34
|
+
level: number;
|
|
35
|
+
category: string;
|
|
36
|
+
message: string;
|
|
37
|
+
metadata?: Record<string, unknown>;
|
|
38
|
+
timestamp: string; // ISO8601 string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// ============================================================================
|
|
42
|
+
// Native Log Bridge
|
|
43
|
+
// ============================================================================
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Bridge for receiving native logs in TypeScript.
|
|
47
|
+
* Registers as a forwarder on native SDKLoggers.
|
|
48
|
+
*/
|
|
49
|
+
export class NativeLogBridge {
|
|
50
|
+
private static initialized = false;
|
|
51
|
+
private static nativeLogsEnabled = true;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Initialize the native log bridge.
|
|
55
|
+
* Call this once at app startup to start receiving native logs.
|
|
56
|
+
*/
|
|
57
|
+
static initialize(): void {
|
|
58
|
+
if (this.initialized) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// The actual native bridge registration happens automatically
|
|
63
|
+
// when native code calls the forwarder. This is a marker that
|
|
64
|
+
// TypeScript is ready to receive logs.
|
|
65
|
+
this.initialized = true;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Enable or disable native log forwarding to TypeScript
|
|
70
|
+
*/
|
|
71
|
+
static setEnabled(enabled: boolean): void {
|
|
72
|
+
this.nativeLogsEnabled = enabled;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Check if native log forwarding is enabled
|
|
77
|
+
*/
|
|
78
|
+
static isEnabled(): boolean {
|
|
79
|
+
return this.nativeLogsEnabled;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Handle a log entry from native code.
|
|
84
|
+
* Called by the native bridge when a log is received.
|
|
85
|
+
*
|
|
86
|
+
* @param entryData - Native log entry data
|
|
87
|
+
*/
|
|
88
|
+
static handleNativeLog(entryData: NativeLogEntryData): void {
|
|
89
|
+
if (!this.nativeLogsEnabled) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Convert to TypeScript LogEntry
|
|
94
|
+
const entry: LogEntry = {
|
|
95
|
+
level: entryData.level as LogLevel,
|
|
96
|
+
category: `Native.${entryData.category}`,
|
|
97
|
+
message: entryData.message,
|
|
98
|
+
metadata: entryData.metadata,
|
|
99
|
+
timestamp: new Date(entryData.timestamp),
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// Forward to LoggingManager destinations (except console, since native already logged)
|
|
103
|
+
// We use a special method that skips console but sends to other destinations
|
|
104
|
+
this.forwardToDestinations(entry);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Forward a log entry to non-console destinations.
|
|
109
|
+
* This avoids duplicate console logging (native already logged to console).
|
|
110
|
+
*/
|
|
111
|
+
private static forwardToDestinations(entry: LogEntry): void {
|
|
112
|
+
const manager = LoggingManager.shared;
|
|
113
|
+
const destinations = manager.getDestinations();
|
|
114
|
+
|
|
115
|
+
for (const destination of destinations) {
|
|
116
|
+
// Skip console destination (native already logged)
|
|
117
|
+
if (destination.identifier === 'console') {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (destination.isAvailable) {
|
|
122
|
+
try {
|
|
123
|
+
destination.write(entry);
|
|
124
|
+
} catch {
|
|
125
|
+
// Silently ignore destination errors
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// ============================================================================
|
|
133
|
+
// Global handler for native bridge
|
|
134
|
+
// ============================================================================
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Global function that native code can call to forward logs.
|
|
138
|
+
* This is registered as a callback that native code invokes.
|
|
139
|
+
*
|
|
140
|
+
* @param entryJson - JSON string of NativeLogEntryData
|
|
141
|
+
*/
|
|
142
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
143
|
+
(global as any).__runanywhereHandleNativeLog = (
|
|
144
|
+
entryData: NativeLogEntryData
|
|
145
|
+
): void => {
|
|
146
|
+
NativeLogBridge.handleNativeLog(entryData);
|
|
147
|
+
};
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SentryDestination.ts
|
|
3
|
+
*
|
|
4
|
+
* Log destination that sends logs to Sentry for error tracking.
|
|
5
|
+
*
|
|
6
|
+
* Matches iOS: sdk/runanywhere-swift/Sources/RunAnywhere/Infrastructure/Logging/SentryDestination.swift
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* import * as Sentry from '@sentry/react-native';
|
|
10
|
+
* import { SentryDestination, LoggingManager } from '@runanywhere/core';
|
|
11
|
+
*
|
|
12
|
+
* // Initialize Sentry first
|
|
13
|
+
* Sentry.init({ dsn: 'your-dsn-here' });
|
|
14
|
+
*
|
|
15
|
+
* // Add Sentry destination
|
|
16
|
+
* const sentryDest = new SentryDestination(Sentry);
|
|
17
|
+
* LoggingManager.shared.addDestination(sentryDest);
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { LogLevel } from '../Models/LogLevel';
|
|
21
|
+
import type { LogDestination, LogEntry } from '../Services/LoggingManager';
|
|
22
|
+
|
|
23
|
+
// ============================================================================
|
|
24
|
+
// Sentry Types (minimal interface to avoid hard dependency)
|
|
25
|
+
// ============================================================================
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Minimal Sentry interface for logging
|
|
29
|
+
* This allows apps to pass their own Sentry instance
|
|
30
|
+
*/
|
|
31
|
+
export interface SentryInterface {
|
|
32
|
+
addBreadcrumb(breadcrumb: {
|
|
33
|
+
message?: string;
|
|
34
|
+
category?: string;
|
|
35
|
+
level?: 'fatal' | 'error' | 'warning' | 'info' | 'debug';
|
|
36
|
+
data?: Record<string, unknown>;
|
|
37
|
+
timestamp?: number;
|
|
38
|
+
}): void;
|
|
39
|
+
|
|
40
|
+
captureMessage(
|
|
41
|
+
message: string,
|
|
42
|
+
level?: 'fatal' | 'error' | 'warning' | 'info' | 'debug'
|
|
43
|
+
): string;
|
|
44
|
+
|
|
45
|
+
captureException(exception: Error, hint?: { extra?: Record<string, unknown> }): string;
|
|
46
|
+
|
|
47
|
+
setExtra(key: string, extra: unknown): void;
|
|
48
|
+
setTag(key: string, value: string): void;
|
|
49
|
+
|
|
50
|
+
flush(timeout?: number): Promise<boolean>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// ============================================================================
|
|
54
|
+
// Sentry Destination
|
|
55
|
+
// ============================================================================
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Log destination that sends warning+ logs to Sentry.
|
|
59
|
+
* Matches iOS: SentryDestination
|
|
60
|
+
*/
|
|
61
|
+
export class SentryDestination implements LogDestination {
|
|
62
|
+
static readonly DESTINATION_ID = 'com.runanywhere.logging.sentry';
|
|
63
|
+
|
|
64
|
+
readonly identifier = SentryDestination.DESTINATION_ID;
|
|
65
|
+
readonly name = 'Sentry';
|
|
66
|
+
|
|
67
|
+
private sentry: SentryInterface | null = null;
|
|
68
|
+
private initialized = false;
|
|
69
|
+
|
|
70
|
+
/** Minimum level to send to Sentry (warning and above) */
|
|
71
|
+
private readonly minSentryLevel: LogLevel = LogLevel.Warning;
|
|
72
|
+
|
|
73
|
+
constructor(sentry?: SentryInterface) {
|
|
74
|
+
if (sentry) {
|
|
75
|
+
this.initialize(sentry);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// ==========================================================================
|
|
80
|
+
// Initialization
|
|
81
|
+
// ==========================================================================
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Initialize with a Sentry instance
|
|
85
|
+
* @param sentry - Sentry SDK instance
|
|
86
|
+
*/
|
|
87
|
+
initialize(sentry: SentryInterface): void {
|
|
88
|
+
this.sentry = sentry;
|
|
89
|
+
this.initialized = true;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Check if Sentry is available
|
|
94
|
+
*/
|
|
95
|
+
get isAvailable(): boolean {
|
|
96
|
+
return this.initialized && this.sentry !== null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// ==========================================================================
|
|
100
|
+
// LogDestination Implementation
|
|
101
|
+
// ==========================================================================
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Write a log entry to Sentry
|
|
105
|
+
* Matches iOS: write(_ entry: LogEntry)
|
|
106
|
+
*/
|
|
107
|
+
write(entry: LogEntry): void {
|
|
108
|
+
if (!this.isAvailable || !this.sentry) return;
|
|
109
|
+
if (entry.level < this.minSentryLevel) return;
|
|
110
|
+
|
|
111
|
+
// Add breadcrumb for context trail
|
|
112
|
+
this.addBreadcrumb(entry);
|
|
113
|
+
|
|
114
|
+
// For error and fault levels, capture as Sentry event
|
|
115
|
+
if (entry.level >= LogLevel.Error) {
|
|
116
|
+
this.captureEvent(entry);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Flush pending Sentry events
|
|
122
|
+
*/
|
|
123
|
+
flush(): void {
|
|
124
|
+
if (!this.isAvailable || !this.sentry) return;
|
|
125
|
+
// Fire and forget - Sentry.flush returns a promise but we don't wait
|
|
126
|
+
void this.sentry.flush(2000);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// ==========================================================================
|
|
130
|
+
// Private Helpers
|
|
131
|
+
// ==========================================================================
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Add a breadcrumb for the log entry
|
|
135
|
+
*/
|
|
136
|
+
private addBreadcrumb(entry: LogEntry): void {
|
|
137
|
+
if (!this.sentry) return;
|
|
138
|
+
|
|
139
|
+
this.sentry.addBreadcrumb({
|
|
140
|
+
message: entry.message,
|
|
141
|
+
category: entry.category,
|
|
142
|
+
level: this.convertToSentryLevel(entry.level),
|
|
143
|
+
data: entry.metadata as Record<string, unknown>,
|
|
144
|
+
timestamp: entry.timestamp.getTime() / 1000, // Sentry uses seconds
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Capture an event for error/fault level logs
|
|
150
|
+
*/
|
|
151
|
+
private captureEvent(entry: LogEntry): void {
|
|
152
|
+
if (!this.sentry) return;
|
|
153
|
+
|
|
154
|
+
// Set tags
|
|
155
|
+
this.sentry.setTag('category', entry.category);
|
|
156
|
+
this.sentry.setTag('log_level', this.getLogLevelDescription(entry.level));
|
|
157
|
+
|
|
158
|
+
// Set extras
|
|
159
|
+
if (entry.metadata) {
|
|
160
|
+
for (const [key, value] of Object.entries(entry.metadata)) {
|
|
161
|
+
this.sentry.setExtra(key, value);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Capture the message
|
|
166
|
+
this.sentry.captureMessage(
|
|
167
|
+
`[${entry.category}] ${entry.message}`,
|
|
168
|
+
this.convertToSentryLevel(entry.level)
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Convert LogLevel to Sentry severity level
|
|
174
|
+
*/
|
|
175
|
+
private convertToSentryLevel(
|
|
176
|
+
level: LogLevel
|
|
177
|
+
): 'fatal' | 'error' | 'warning' | 'info' | 'debug' {
|
|
178
|
+
switch (level) {
|
|
179
|
+
case LogLevel.Debug:
|
|
180
|
+
return 'debug';
|
|
181
|
+
case LogLevel.Info:
|
|
182
|
+
return 'info';
|
|
183
|
+
case LogLevel.Warning:
|
|
184
|
+
return 'warning';
|
|
185
|
+
case LogLevel.Error:
|
|
186
|
+
return 'error';
|
|
187
|
+
case LogLevel.Fault:
|
|
188
|
+
return 'fatal';
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Get log level description
|
|
194
|
+
*/
|
|
195
|
+
private getLogLevelDescription(level: LogLevel): string {
|
|
196
|
+
switch (level) {
|
|
197
|
+
case LogLevel.Debug:
|
|
198
|
+
return 'debug';
|
|
199
|
+
case LogLevel.Info:
|
|
200
|
+
return 'info';
|
|
201
|
+
case LogLevel.Warning:
|
|
202
|
+
return 'warning';
|
|
203
|
+
case LogLevel.Error:
|
|
204
|
+
return 'error';
|
|
205
|
+
case LogLevel.Fault:
|
|
206
|
+
return 'fault';
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|