@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,357 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDKLogger.kt
|
|
3
|
+
*
|
|
4
|
+
* Android native logging implementation for React Native SDK.
|
|
5
|
+
* Provides structured logging with category-based filtering.
|
|
6
|
+
* Supports forwarding logs to TypeScript for centralized logging.
|
|
7
|
+
*
|
|
8
|
+
* Matches:
|
|
9
|
+
* - iOS SDK: sdk/runanywhere-swift/Sources/RunAnywhere/Infrastructure/Logging/SDKLogger.swift
|
|
10
|
+
* - TypeScript: packages/core/src/Foundation/Logging/Logger/SDKLogger.ts
|
|
11
|
+
* - iOS RN: packages/core/ios/SDKLogger.swift
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* SDKLogger.shared.info("SDK initialized")
|
|
15
|
+
* SDKLogger.download.debug("Starting download: $url")
|
|
16
|
+
* SDKLogger.llm.error("Generation failed", mapOf("modelId" to "llama-3.2"))
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
package com.margelo.nitro.runanywhere
|
|
20
|
+
|
|
21
|
+
import android.util.Log
|
|
22
|
+
import java.text.SimpleDateFormat
|
|
23
|
+
import java.util.Date
|
|
24
|
+
import java.util.Locale
|
|
25
|
+
import java.util.TimeZone
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Log severity levels matching TypeScript LogLevel enum
|
|
29
|
+
*/
|
|
30
|
+
enum class LogLevel(val value: Int) {
|
|
31
|
+
Debug(0),
|
|
32
|
+
Info(1),
|
|
33
|
+
Warning(2),
|
|
34
|
+
Error(3),
|
|
35
|
+
Fault(4);
|
|
36
|
+
|
|
37
|
+
val description: String
|
|
38
|
+
get() = when (this) {
|
|
39
|
+
Debug -> "DEBUG"
|
|
40
|
+
Info -> "INFO"
|
|
41
|
+
Warning -> "WARN"
|
|
42
|
+
Error -> "ERROR"
|
|
43
|
+
Fault -> "FAULT"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
companion object {
|
|
47
|
+
fun fromValue(value: Int): LogLevel = entries.find { it.value == value } ?: Info
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Log entry for forwarding to TypeScript
|
|
53
|
+
* Matches TypeScript: LogEntry interface
|
|
54
|
+
*/
|
|
55
|
+
data class NativeLogEntry(
|
|
56
|
+
val level: Int,
|
|
57
|
+
val category: String,
|
|
58
|
+
val message: String,
|
|
59
|
+
val metadata: Map<String, Any?>?,
|
|
60
|
+
val timestamp: Date
|
|
61
|
+
) {
|
|
62
|
+
/**
|
|
63
|
+
* Convert to Map for JSON serialization
|
|
64
|
+
*/
|
|
65
|
+
fun toMap(): Map<String, Any?> {
|
|
66
|
+
val isoFormatter = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US).apply {
|
|
67
|
+
timeZone = TimeZone.getTimeZone("UTC")
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return mapOf(
|
|
71
|
+
"level" to level,
|
|
72
|
+
"category" to category,
|
|
73
|
+
"message" to message,
|
|
74
|
+
"timestamp" to isoFormatter.format(timestamp),
|
|
75
|
+
"metadata" to metadata?.mapValues { (_, value) ->
|
|
76
|
+
when (value) {
|
|
77
|
+
is String, is Number, is Boolean -> value
|
|
78
|
+
else -> value?.toString()
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Interface for forwarding logs to TypeScript
|
|
87
|
+
*/
|
|
88
|
+
interface NativeLogForwarder {
|
|
89
|
+
fun forwardLog(entry: NativeLogEntry)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Simple logger for SDK components with category-based filtering.
|
|
94
|
+
* Thread-safe and easy to use.
|
|
95
|
+
*
|
|
96
|
+
* Matches iOS: SDKLogger class
|
|
97
|
+
*/
|
|
98
|
+
class SDKLogger(
|
|
99
|
+
/** Logger category (e.g., "LLM", "Download", "Models") */
|
|
100
|
+
val category: String = "SDK"
|
|
101
|
+
) {
|
|
102
|
+
companion object {
|
|
103
|
+
/** Minimum log level (logs below this level are ignored) */
|
|
104
|
+
@Volatile
|
|
105
|
+
private var minLogLevel: LogLevel = LogLevel.Debug
|
|
106
|
+
|
|
107
|
+
/** Whether local logcat logging is enabled */
|
|
108
|
+
@Volatile
|
|
109
|
+
private var localLoggingEnabled = true
|
|
110
|
+
|
|
111
|
+
/** Whether to forward logs to TypeScript */
|
|
112
|
+
@Volatile
|
|
113
|
+
private var forwardingEnabled = true
|
|
114
|
+
|
|
115
|
+
/** Log forwarder for TypeScript bridge */
|
|
116
|
+
@Volatile
|
|
117
|
+
private var logForwarder: NativeLogForwarder? = null
|
|
118
|
+
|
|
119
|
+
// ==================================================================
|
|
120
|
+
// Configuration
|
|
121
|
+
// ==================================================================
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Set the minimum log level.
|
|
125
|
+
* @param level Minimum level to log
|
|
126
|
+
*/
|
|
127
|
+
@JvmStatic
|
|
128
|
+
fun setMinLogLevel(level: LogLevel) {
|
|
129
|
+
minLogLevel = level
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Get the current minimum log level.
|
|
134
|
+
*/
|
|
135
|
+
@JvmStatic
|
|
136
|
+
fun getMinLogLevel(): LogLevel = minLogLevel
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Enable or disable local logcat logging.
|
|
140
|
+
* @param enabled Whether to log to logcat
|
|
141
|
+
*/
|
|
142
|
+
@JvmStatic
|
|
143
|
+
fun setLocalLoggingEnabled(enabled: Boolean) {
|
|
144
|
+
localLoggingEnabled = enabled
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Enable or disable log forwarding to TypeScript.
|
|
149
|
+
* @param enabled Whether to forward logs
|
|
150
|
+
*/
|
|
151
|
+
@JvmStatic
|
|
152
|
+
fun setForwardingEnabled(enabled: Boolean) {
|
|
153
|
+
forwardingEnabled = enabled
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Set the log forwarder for TypeScript bridge.
|
|
158
|
+
* @param forwarder Log forwarder implementation
|
|
159
|
+
*/
|
|
160
|
+
@JvmStatic
|
|
161
|
+
fun setLogForwarder(forwarder: NativeLogForwarder?) {
|
|
162
|
+
logForwarder = forwarder
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Check if log forwarding is configured
|
|
167
|
+
*/
|
|
168
|
+
@JvmStatic
|
|
169
|
+
fun isForwardingConfigured(): Boolean = logForwarder != null && forwardingEnabled
|
|
170
|
+
|
|
171
|
+
// ==================================================================
|
|
172
|
+
// Convenience Loggers (Static)
|
|
173
|
+
// ==================================================================
|
|
174
|
+
|
|
175
|
+
/** Shared logger for general SDK operations. Category: "RunAnywhere" */
|
|
176
|
+
@JvmField
|
|
177
|
+
val shared = SDKLogger("RunAnywhere")
|
|
178
|
+
|
|
179
|
+
/** Logger for LLM operations. Category: "LLM" */
|
|
180
|
+
@JvmField
|
|
181
|
+
val llm = SDKLogger("LLM")
|
|
182
|
+
|
|
183
|
+
/** Logger for STT (Speech-to-Text) operations. Category: "STT" */
|
|
184
|
+
@JvmField
|
|
185
|
+
val stt = SDKLogger("STT")
|
|
186
|
+
|
|
187
|
+
/** Logger for TTS (Text-to-Speech) operations. Category: "TTS" */
|
|
188
|
+
@JvmField
|
|
189
|
+
val tts = SDKLogger("TTS")
|
|
190
|
+
|
|
191
|
+
/** Logger for download operations. Category: "Download" */
|
|
192
|
+
@JvmField
|
|
193
|
+
val download = SDKLogger("Download")
|
|
194
|
+
|
|
195
|
+
/** Logger for model operations. Category: "Models" */
|
|
196
|
+
@JvmField
|
|
197
|
+
val models = SDKLogger("Models")
|
|
198
|
+
|
|
199
|
+
/** Logger for core SDK operations. Category: "Core" */
|
|
200
|
+
@JvmField
|
|
201
|
+
val core = SDKLogger("Core")
|
|
202
|
+
|
|
203
|
+
/** Logger for VAD operations. Category: "VAD" */
|
|
204
|
+
@JvmField
|
|
205
|
+
val vad = SDKLogger("VAD")
|
|
206
|
+
|
|
207
|
+
/** Logger for network operations. Category: "Network" */
|
|
208
|
+
@JvmField
|
|
209
|
+
val network = SDKLogger("Network")
|
|
210
|
+
|
|
211
|
+
/** Logger for events. Category: "Events" */
|
|
212
|
+
@JvmField
|
|
213
|
+
val events = SDKLogger("Events")
|
|
214
|
+
|
|
215
|
+
/** Logger for archive/extraction operations. Category: "Archive" */
|
|
216
|
+
@JvmField
|
|
217
|
+
val archive = SDKLogger("Archive")
|
|
218
|
+
|
|
219
|
+
/** Logger for audio decoding operations. Category: "AudioDecoder" */
|
|
220
|
+
@JvmField
|
|
221
|
+
val audioDecoder = SDKLogger("AudioDecoder")
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// ==================================================================
|
|
225
|
+
// Logging Methods
|
|
226
|
+
// ==================================================================
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Log a debug message.
|
|
230
|
+
* @param message Log message
|
|
231
|
+
* @param metadata Optional metadata map
|
|
232
|
+
*/
|
|
233
|
+
@JvmOverloads
|
|
234
|
+
fun debug(message: String, metadata: Map<String, Any?>? = null) {
|
|
235
|
+
log(LogLevel.Debug, message, metadata)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Log an info message.
|
|
240
|
+
* @param message Log message
|
|
241
|
+
* @param metadata Optional metadata map
|
|
242
|
+
*/
|
|
243
|
+
@JvmOverloads
|
|
244
|
+
fun info(message: String, metadata: Map<String, Any?>? = null) {
|
|
245
|
+
log(LogLevel.Info, message, metadata)
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Log a warning message.
|
|
250
|
+
* @param message Log message
|
|
251
|
+
* @param metadata Optional metadata map
|
|
252
|
+
*/
|
|
253
|
+
@JvmOverloads
|
|
254
|
+
fun warning(message: String, metadata: Map<String, Any?>? = null) {
|
|
255
|
+
log(LogLevel.Warning, message, metadata)
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Log an error message.
|
|
260
|
+
* @param message Log message
|
|
261
|
+
* @param metadata Optional metadata map
|
|
262
|
+
*/
|
|
263
|
+
@JvmOverloads
|
|
264
|
+
fun error(message: String, metadata: Map<String, Any?>? = null) {
|
|
265
|
+
log(LogLevel.Error, message, metadata)
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Log a fault/critical message.
|
|
270
|
+
* @param message Log message
|
|
271
|
+
* @param metadata Optional metadata map
|
|
272
|
+
*/
|
|
273
|
+
@JvmOverloads
|
|
274
|
+
fun fault(message: String, metadata: Map<String, Any?>? = null) {
|
|
275
|
+
log(LogLevel.Fault, message, metadata)
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// ==================================================================
|
|
279
|
+
// Error Logging
|
|
280
|
+
// ==================================================================
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Log a Throwable with full context.
|
|
284
|
+
* @param throwable Throwable to log
|
|
285
|
+
* @param additionalInfo Optional additional context
|
|
286
|
+
*/
|
|
287
|
+
@JvmOverloads
|
|
288
|
+
fun logError(throwable: Throwable, additionalInfo: String? = null) {
|
|
289
|
+
var message = throwable.message ?: throwable.toString()
|
|
290
|
+
if (additionalInfo != null) {
|
|
291
|
+
message += " | Context: $additionalInfo"
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
val metadata = mutableMapOf<String, Any?>(
|
|
295
|
+
"error_class" to throwable.javaClass.simpleName,
|
|
296
|
+
"error_message" to throwable.message
|
|
297
|
+
)
|
|
298
|
+
|
|
299
|
+
throwable.cause?.let { cause ->
|
|
300
|
+
metadata["error_cause"] = cause.message
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
log(LogLevel.Error, message, metadata)
|
|
304
|
+
|
|
305
|
+
// Also log stack trace at debug level
|
|
306
|
+
if (minLogLevel <= LogLevel.Debug) {
|
|
307
|
+
Log.d(category, "Stack trace:", throwable)
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// ==================================================================
|
|
312
|
+
// Core Logging
|
|
313
|
+
// ==================================================================
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Log a message with the specified level.
|
|
317
|
+
* @param level Log level
|
|
318
|
+
* @param message Log message
|
|
319
|
+
* @param metadata Optional metadata map
|
|
320
|
+
*/
|
|
321
|
+
fun log(level: LogLevel, message: String, metadata: Map<String, Any?>? = null) {
|
|
322
|
+
if (level.value < minLogLevel.value) return
|
|
323
|
+
|
|
324
|
+
val timestamp = Date()
|
|
325
|
+
|
|
326
|
+
// Build formatted message
|
|
327
|
+
var output = "[$category] $message"
|
|
328
|
+
if (!metadata.isNullOrEmpty()) {
|
|
329
|
+
val metaStr = metadata.entries.joinToString(", ") { "${it.key}=${it.value}" }
|
|
330
|
+
output += " | $metaStr"
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// Log to Android Log (logcat) if enabled
|
|
334
|
+
if (localLoggingEnabled) {
|
|
335
|
+
when (level) {
|
|
336
|
+
LogLevel.Debug -> Log.d(category, output)
|
|
337
|
+
LogLevel.Info -> Log.i(category, output)
|
|
338
|
+
LogLevel.Warning -> Log.w(category, output)
|
|
339
|
+
LogLevel.Error -> Log.e(category, output)
|
|
340
|
+
LogLevel.Fault -> Log.wtf(category, output) // "What a Terrible Failure"
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// Forward to TypeScript if enabled
|
|
345
|
+
if (forwardingEnabled) {
|
|
346
|
+
logForwarder?.forwardLog(
|
|
347
|
+
NativeLogEntry(
|
|
348
|
+
level = level.value,
|
|
349
|
+
category = category,
|
|
350
|
+
message = message,
|
|
351
|
+
metadata = metadata,
|
|
352
|
+
timestamp = timestamp
|
|
353
|
+
)
|
|
354
|
+
)
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SecureStorageManager.kt
|
|
3
|
+
*
|
|
4
|
+
* Android secure storage using EncryptedSharedPreferences.
|
|
5
|
+
* Provides hardware-backed encryption when available (Android Keystore).
|
|
6
|
+
*
|
|
7
|
+
* Reference: sdk/runanywhere-kotlin/src/androidMain/kotlin/com/runanywhere/sdk/security/SecureStorage.kt
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.margelo.nitro.runanywhere
|
|
11
|
+
|
|
12
|
+
import android.annotation.SuppressLint
|
|
13
|
+
import android.content.Context
|
|
14
|
+
import android.content.SharedPreferences
|
|
15
|
+
import android.util.Log
|
|
16
|
+
import androidx.security.crypto.EncryptedSharedPreferences
|
|
17
|
+
import androidx.security.crypto.MasterKey
|
|
18
|
+
import java.util.UUID
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Secure storage manager for persistent device identity and sensitive data.
|
|
22
|
+
* Uses EncryptedSharedPreferences backed by Android Keystore.
|
|
23
|
+
*/
|
|
24
|
+
object SecureStorageManager {
|
|
25
|
+
private const val TAG = "SecureStorageManager"
|
|
26
|
+
private const val PREFS_NAME = "runanywhere_secure_prefs"
|
|
27
|
+
private const val DEVICE_UUID_KEY = "com.runanywhere.sdk.device.uuid"
|
|
28
|
+
|
|
29
|
+
@SuppressLint("StaticFieldLeak")
|
|
30
|
+
private var context: Context? = null
|
|
31
|
+
private var encryptedPrefs: SharedPreferences? = null
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Get the stored context (for platform bridge operations)
|
|
35
|
+
*/
|
|
36
|
+
@JvmStatic
|
|
37
|
+
fun getContext(): Context? = context
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Initialize with application context
|
|
41
|
+
* Must be called before any other operations
|
|
42
|
+
*/
|
|
43
|
+
@JvmStatic
|
|
44
|
+
fun initialize(applicationContext: Context) {
|
|
45
|
+
if (context != null) return
|
|
46
|
+
|
|
47
|
+
context = applicationContext.applicationContext
|
|
48
|
+
try {
|
|
49
|
+
val masterKey = MasterKey.Builder(context!!)
|
|
50
|
+
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
|
|
51
|
+
.build()
|
|
52
|
+
|
|
53
|
+
encryptedPrefs = EncryptedSharedPreferences.create(
|
|
54
|
+
context!!,
|
|
55
|
+
PREFS_NAME,
|
|
56
|
+
masterKey,
|
|
57
|
+
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
|
|
58
|
+
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
|
|
59
|
+
)
|
|
60
|
+
Log.i(TAG, "SecureStorageManager initialized")
|
|
61
|
+
} catch (e: Exception) {
|
|
62
|
+
Log.e(TAG, "Failed to initialize EncryptedSharedPreferences", e)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Set a secure string value
|
|
68
|
+
*/
|
|
69
|
+
@JvmStatic
|
|
70
|
+
fun set(key: String, value: String): Boolean {
|
|
71
|
+
return try {
|
|
72
|
+
encryptedPrefs?.edit()?.putString(key, value)?.apply()
|
|
73
|
+
Log.d(TAG, "secureSet key=$key")
|
|
74
|
+
true
|
|
75
|
+
} catch (e: Exception) {
|
|
76
|
+
Log.e(TAG, "secureSet failed for key=$key", e)
|
|
77
|
+
false
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Get a secure string value
|
|
83
|
+
*/
|
|
84
|
+
@JvmStatic
|
|
85
|
+
fun get(key: String): String? {
|
|
86
|
+
return try {
|
|
87
|
+
val value = encryptedPrefs?.getString(key, null)
|
|
88
|
+
Log.d(TAG, "secureGet key=$key found=${value != null}")
|
|
89
|
+
value
|
|
90
|
+
} catch (e: Exception) {
|
|
91
|
+
Log.e(TAG, "secureGet failed for key=$key", e)
|
|
92
|
+
null
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Delete a secure value
|
|
98
|
+
*/
|
|
99
|
+
@JvmStatic
|
|
100
|
+
fun delete(key: String): Boolean {
|
|
101
|
+
return try {
|
|
102
|
+
encryptedPrefs?.edit()?.remove(key)?.apply()
|
|
103
|
+
Log.d(TAG, "secureDelete key=$key")
|
|
104
|
+
true
|
|
105
|
+
} catch (e: Exception) {
|
|
106
|
+
Log.e(TAG, "secureDelete failed for key=$key", e)
|
|
107
|
+
false
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Check if key exists
|
|
113
|
+
*/
|
|
114
|
+
@JvmStatic
|
|
115
|
+
fun exists(key: String): Boolean {
|
|
116
|
+
return try {
|
|
117
|
+
encryptedPrefs?.contains(key) ?: false
|
|
118
|
+
} catch (e: Exception) {
|
|
119
|
+
Log.e(TAG, "secureExists failed for key=$key", e)
|
|
120
|
+
false
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Get or create persistent device UUID
|
|
126
|
+
* Survives app reinstalls (stored in EncryptedSharedPreferences)
|
|
127
|
+
*/
|
|
128
|
+
@JvmStatic
|
|
129
|
+
fun getPersistentDeviceUUID(): String {
|
|
130
|
+
// Try to get existing UUID
|
|
131
|
+
val existingUUID = get(DEVICE_UUID_KEY)
|
|
132
|
+
if (!existingUUID.isNullOrEmpty()) {
|
|
133
|
+
Log.i(TAG, "Loaded persistent device UUID from secure storage")
|
|
134
|
+
return existingUUID
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Generate new UUID
|
|
138
|
+
val newUUID = UUID.randomUUID().toString()
|
|
139
|
+
if (set(DEVICE_UUID_KEY, newUUID)) {
|
|
140
|
+
Log.i(TAG, "Generated and stored new persistent device UUID")
|
|
141
|
+
} else {
|
|
142
|
+
Log.w(TAG, "Generated device UUID but failed to persist")
|
|
143
|
+
}
|
|
144
|
+
return newUUID
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|