@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,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HybridRunAnywhereDeviceInfo.kt
|
|
3
|
+
*
|
|
4
|
+
* Android implementation of device information for RunAnywhere SDK.
|
|
5
|
+
* Provides device capabilities, memory info, and battery status.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.runanywhere
|
|
9
|
+
|
|
10
|
+
import android.app.ActivityManager
|
|
11
|
+
import android.content.Context
|
|
12
|
+
import android.os.BatteryManager
|
|
13
|
+
import android.os.Build
|
|
14
|
+
import android.os.PowerManager
|
|
15
|
+
import com.margelo.nitro.NitroModules
|
|
16
|
+
import com.margelo.nitro.core.Promise
|
|
17
|
+
import java.io.BufferedReader
|
|
18
|
+
import java.io.File
|
|
19
|
+
import java.io.FileReader
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Kotlin implementation of RunAnywhereDeviceInfo HybridObject.
|
|
23
|
+
* Provides device information and capabilities for the RunAnywhere SDK on Android.
|
|
24
|
+
*/
|
|
25
|
+
class HybridRunAnywhereDeviceInfo : HybridRunAnywhereDeviceInfoSpec() {
|
|
26
|
+
|
|
27
|
+
companion object {
|
|
28
|
+
private val logger = SDKLogger.core
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private val context = NitroModules.applicationContext ?: error("Android context not found")
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Get device model name
|
|
35
|
+
*/
|
|
36
|
+
override fun getDeviceModel(): Promise<String> = Promise.async {
|
|
37
|
+
val manufacturer = Build.MANUFACTURER
|
|
38
|
+
val model = Build.MODEL
|
|
39
|
+
if (model.startsWith(manufacturer, ignoreCase = true)) {
|
|
40
|
+
model.capitalize()
|
|
41
|
+
} else {
|
|
42
|
+
"${manufacturer.capitalize()} $model"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Get OS version
|
|
48
|
+
*/
|
|
49
|
+
override fun getOSVersion(): Promise<String> = Promise.async {
|
|
50
|
+
Build.VERSION.RELEASE
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Get platform name
|
|
55
|
+
*/
|
|
56
|
+
override fun getPlatform(): Promise<String> = Promise.async {
|
|
57
|
+
"android"
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Get total RAM in bytes
|
|
62
|
+
*/
|
|
63
|
+
override fun getTotalRAM(): Promise<Double> = Promise.async {
|
|
64
|
+
val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
|
|
65
|
+
val memInfo = ActivityManager.MemoryInfo()
|
|
66
|
+
activityManager.getMemoryInfo(memInfo)
|
|
67
|
+
memInfo.totalMem.toDouble()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Get available RAM in bytes
|
|
72
|
+
*/
|
|
73
|
+
override fun getAvailableRAM(): Promise<Double> = Promise.async {
|
|
74
|
+
val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
|
|
75
|
+
val memInfo = ActivityManager.MemoryInfo()
|
|
76
|
+
activityManager.getMemoryInfo(memInfo)
|
|
77
|
+
memInfo.availMem.toDouble()
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Get number of CPU cores
|
|
82
|
+
*/
|
|
83
|
+
override fun getCPUCores(): Promise<Double> = Promise.async {
|
|
84
|
+
Runtime.getRuntime().availableProcessors().toDouble()
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Check if device has GPU acceleration
|
|
89
|
+
*/
|
|
90
|
+
override fun hasGPU(): Promise<Boolean> = Promise.async {
|
|
91
|
+
// Check for Vulkan support as indicator of modern GPU
|
|
92
|
+
val hasVulkan = try {
|
|
93
|
+
val pm = context.packageManager
|
|
94
|
+
pm.hasSystemFeature("android.hardware.vulkan.level")
|
|
95
|
+
} catch (e: Exception) {
|
|
96
|
+
false
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Most Android devices have some GPU
|
|
100
|
+
hasVulkan || Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Check if device has Neural Engine / NPU
|
|
105
|
+
*/
|
|
106
|
+
override fun hasNPU(): Promise<Boolean> = Promise.async {
|
|
107
|
+
// Android Neural Networks API (NNAPI) is available on API 27+
|
|
108
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
|
109
|
+
val hardware = Build.HARDWARE.lowercase()
|
|
110
|
+
val soc = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
|
111
|
+
Build.SOC_MODEL.lowercase()
|
|
112
|
+
} else {
|
|
113
|
+
""
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
listOf(
|
|
117
|
+
"qcom", // Qualcomm (Hexagon DSP)
|
|
118
|
+
"exynos", // Samsung (NPU)
|
|
119
|
+
"tensor", // Google (TPU)
|
|
120
|
+
"kirin", // Huawei (NPU)
|
|
121
|
+
"dimensity", // MediaTek (APU)
|
|
122
|
+
"mtk" // MediaTek
|
|
123
|
+
).any { hardware.contains(it) || soc.contains(it) }
|
|
124
|
+
} else {
|
|
125
|
+
false
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Get chip name if available
|
|
131
|
+
*/
|
|
132
|
+
override fun getChipName(): Promise<String> = Promise.async {
|
|
133
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
|
134
|
+
val socModel = Build.SOC_MODEL
|
|
135
|
+
val socManufacturer = Build.SOC_MANUFACTURER
|
|
136
|
+
if (socModel.isNotEmpty() && socModel != "unknown") {
|
|
137
|
+
if (socManufacturer.isNotEmpty() && socManufacturer != "unknown") {
|
|
138
|
+
"$socManufacturer $socModel"
|
|
139
|
+
} else {
|
|
140
|
+
socModel
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
getCPUInfo()
|
|
144
|
+
}
|
|
145
|
+
} else {
|
|
146
|
+
getCPUInfo()
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Get device thermal state (0 = nominal, 1 = fair, 2 = serious, 3 = critical)
|
|
152
|
+
*/
|
|
153
|
+
override fun getThermalState(): Promise<Double> = Promise.async {
|
|
154
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
155
|
+
val powerManager = context.getSystemService(Context.POWER_SERVICE) as PowerManager
|
|
156
|
+
when (powerManager.currentThermalStatus) {
|
|
157
|
+
PowerManager.THERMAL_STATUS_NONE -> 0.0
|
|
158
|
+
PowerManager.THERMAL_STATUS_LIGHT -> 0.0
|
|
159
|
+
PowerManager.THERMAL_STATUS_MODERATE -> 1.0
|
|
160
|
+
PowerManager.THERMAL_STATUS_SEVERE -> 2.0
|
|
161
|
+
PowerManager.THERMAL_STATUS_CRITICAL -> 3.0
|
|
162
|
+
PowerManager.THERMAL_STATUS_EMERGENCY -> 3.0
|
|
163
|
+
PowerManager.THERMAL_STATUS_SHUTDOWN -> 3.0
|
|
164
|
+
else -> 0.0
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
0.0
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Get battery level (0.0 to 1.0)
|
|
173
|
+
*/
|
|
174
|
+
override fun getBatteryLevel(): Promise<Double> = Promise.async {
|
|
175
|
+
val batteryManager = context.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
|
|
176
|
+
val level = batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
|
|
177
|
+
level.toDouble() / 100.0
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Check if device is charging
|
|
182
|
+
*/
|
|
183
|
+
override fun isCharging(): Promise<Boolean> = Promise.async {
|
|
184
|
+
val batteryManager = context.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
|
|
185
|
+
batteryManager.isCharging
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Check if low power mode is enabled
|
|
190
|
+
*/
|
|
191
|
+
override fun isLowPowerMode(): Promise<Boolean> = Promise.async {
|
|
192
|
+
val powerManager = context.getSystemService(Context.POWER_SERVICE) as PowerManager
|
|
193
|
+
powerManager.isPowerSaveMode
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Read CPU info from /proc/cpuinfo
|
|
198
|
+
*/
|
|
199
|
+
private fun getCPUInfo(): String {
|
|
200
|
+
return try {
|
|
201
|
+
val cpuInfo = File("/proc/cpuinfo")
|
|
202
|
+
if (cpuInfo.exists()) {
|
|
203
|
+
BufferedReader(FileReader(cpuInfo)).use { reader ->
|
|
204
|
+
var line: String?
|
|
205
|
+
while (reader.readLine().also { line = it } != null) {
|
|
206
|
+
if (line?.startsWith("Hardware") == true) {
|
|
207
|
+
return line?.substringAfter(":")?.trim() ?: "Unknown"
|
|
208
|
+
}
|
|
209
|
+
if (line?.startsWith("model name") == true) {
|
|
210
|
+
return line?.substringAfter(":")?.trim() ?: "Unknown"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
Build.HARDWARE
|
|
216
|
+
} catch (e: Exception) {
|
|
217
|
+
logger.warning("Failed to read CPU info: ${e.message}")
|
|
218
|
+
Build.HARDWARE
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
private fun String.capitalize(): String {
|
|
223
|
+
return if (isNotEmpty()) {
|
|
224
|
+
this[0].uppercaseChar() + substring(1)
|
|
225
|
+
} else {
|
|
226
|
+
this
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PlatformAdapterBridge.kt
|
|
3
|
+
*
|
|
4
|
+
* JNI bridge for platform-specific operations (secure storage).
|
|
5
|
+
* Called from C++ via JNI.
|
|
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.util.Log
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* JNI bridge that C++ code calls for platform operations.
|
|
16
|
+
* All methods are static and called via JNI from InitBridge.cpp
|
|
17
|
+
*/
|
|
18
|
+
object PlatformAdapterBridge {
|
|
19
|
+
private const val TAG = "PlatformAdapterBridge"
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Called from C++ to set a secure value
|
|
23
|
+
*/
|
|
24
|
+
@JvmStatic
|
|
25
|
+
fun secureSet(key: String, value: String): Boolean {
|
|
26
|
+
Log.d(TAG, "secureSet key=$key")
|
|
27
|
+
return SecureStorageManager.set(key, value)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Called from C++ to get a secure value
|
|
32
|
+
*/
|
|
33
|
+
@JvmStatic
|
|
34
|
+
fun secureGet(key: String): String? {
|
|
35
|
+
Log.d(TAG, "secureGet key=$key")
|
|
36
|
+
return SecureStorageManager.get(key)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Called from C++ to delete a secure value
|
|
41
|
+
*/
|
|
42
|
+
@JvmStatic
|
|
43
|
+
fun secureDelete(key: String): Boolean {
|
|
44
|
+
Log.d(TAG, "secureDelete key=$key")
|
|
45
|
+
return SecureStorageManager.delete(key)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Called from C++ to check if key exists
|
|
50
|
+
*/
|
|
51
|
+
@JvmStatic
|
|
52
|
+
fun secureExists(key: String): Boolean {
|
|
53
|
+
return SecureStorageManager.exists(key)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Called from C++ to get persistent device UUID
|
|
58
|
+
*/
|
|
59
|
+
@JvmStatic
|
|
60
|
+
fun getPersistentDeviceUUID(): String {
|
|
61
|
+
Log.d(TAG, "getPersistentDeviceUUID")
|
|
62
|
+
return SecureStorageManager.getPersistentDeviceUUID()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// ========================================================================
|
|
66
|
+
// HTTP POST for Device Registration (Synchronous)
|
|
67
|
+
// Matches Kotlin SDK's CppBridgeDevice.httpPost
|
|
68
|
+
// ========================================================================
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* HTTP response data class
|
|
72
|
+
*/
|
|
73
|
+
data class HttpResponse(
|
|
74
|
+
val success: Boolean,
|
|
75
|
+
val statusCode: Int,
|
|
76
|
+
val responseBody: String?,
|
|
77
|
+
val errorMessage: String?
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Synchronous HTTP POST for device registration
|
|
82
|
+
* Called from C++ device manager callbacks via JNI
|
|
83
|
+
*
|
|
84
|
+
* @param url Full URL to POST to
|
|
85
|
+
* @param jsonBody JSON body string
|
|
86
|
+
* @param supabaseKey Supabase API key (for dev mode, can be null)
|
|
87
|
+
* @return HttpResponse with result
|
|
88
|
+
*/
|
|
89
|
+
@JvmStatic
|
|
90
|
+
fun httpPostSync(url: String, jsonBody: String, supabaseKey: String?): HttpResponse {
|
|
91
|
+
Log.d(TAG, "httpPostSync to: $url")
|
|
92
|
+
// Log first 300 chars of JSON body for debugging
|
|
93
|
+
Log.d(TAG, "httpPostSync body (first 300 chars): ${jsonBody.take(300)}")
|
|
94
|
+
|
|
95
|
+
// For Supabase device registration, add ?on_conflict=device_id for UPSERT
|
|
96
|
+
// This matches Swift's HTTPService.swift logic
|
|
97
|
+
var finalUrl = url
|
|
98
|
+
if (url.contains("/rest/v1/sdk_devices") && !url.contains("on_conflict=")) {
|
|
99
|
+
val separator = if (url.contains("?")) "&" else "?"
|
|
100
|
+
finalUrl = "$url${separator}on_conflict=device_id"
|
|
101
|
+
Log.d(TAG, "Added on_conflict for UPSERT: $finalUrl")
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return try {
|
|
105
|
+
val urlConnection = java.net.URL(finalUrl).openConnection() as java.net.HttpURLConnection
|
|
106
|
+
urlConnection.requestMethod = "POST"
|
|
107
|
+
urlConnection.connectTimeout = 30000
|
|
108
|
+
urlConnection.readTimeout = 30000
|
|
109
|
+
urlConnection.doOutput = true
|
|
110
|
+
|
|
111
|
+
// Headers
|
|
112
|
+
urlConnection.setRequestProperty("Content-Type", "application/json")
|
|
113
|
+
urlConnection.setRequestProperty("Accept", "application/json")
|
|
114
|
+
|
|
115
|
+
// Supabase headers (for device registration UPSERT)
|
|
116
|
+
if (!supabaseKey.isNullOrEmpty()) {
|
|
117
|
+
urlConnection.setRequestProperty("apikey", supabaseKey)
|
|
118
|
+
urlConnection.setRequestProperty("Authorization", "Bearer $supabaseKey")
|
|
119
|
+
urlConnection.setRequestProperty("Prefer", "resolution=merge-duplicates")
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Write body
|
|
123
|
+
urlConnection.outputStream.use { os ->
|
|
124
|
+
os.write(jsonBody.toByteArray(Charsets.UTF_8))
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
val statusCode = urlConnection.responseCode
|
|
128
|
+
val responseBody = try {
|
|
129
|
+
urlConnection.inputStream.bufferedReader().use { it.readText() }
|
|
130
|
+
} catch (e: Exception) {
|
|
131
|
+
urlConnection.errorStream?.bufferedReader()?.use { it.readText() }
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// 2xx or 409 (conflict/already exists) = success for device registration
|
|
135
|
+
val isSuccess = statusCode in 200..299 || statusCode == 409
|
|
136
|
+
|
|
137
|
+
Log.d(TAG, "httpPostSync completed: status=$statusCode success=$isSuccess")
|
|
138
|
+
if (!isSuccess) {
|
|
139
|
+
Log.e(TAG, "httpPostSync error response: $responseBody")
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
HttpResponse(
|
|
143
|
+
success = isSuccess,
|
|
144
|
+
statusCode = statusCode,
|
|
145
|
+
responseBody = responseBody,
|
|
146
|
+
errorMessage = if (!isSuccess) "HTTP $statusCode" else null
|
|
147
|
+
)
|
|
148
|
+
} catch (e: Exception) {
|
|
149
|
+
Log.e(TAG, "httpPostSync error", e)
|
|
150
|
+
HttpResponse(
|
|
151
|
+
success = false,
|
|
152
|
+
statusCode = 0,
|
|
153
|
+
responseBody = null,
|
|
154
|
+
errorMessage = e.message ?: "Unknown error"
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// ========================================================================
|
|
160
|
+
// Device Info (Synchronous)
|
|
161
|
+
// For device registration callback which must be synchronous
|
|
162
|
+
// ========================================================================
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Get device model name (e.g., "Pixel 8 Pro")
|
|
166
|
+
*/
|
|
167
|
+
@JvmStatic
|
|
168
|
+
fun getDeviceModel(): String {
|
|
169
|
+
return android.os.Build.MODEL
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Get OS version (e.g., "14")
|
|
174
|
+
*/
|
|
175
|
+
@JvmStatic
|
|
176
|
+
fun getOSVersion(): String {
|
|
177
|
+
return android.os.Build.VERSION.RELEASE
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Get chip name (e.g., "Tensor G3")
|
|
182
|
+
*/
|
|
183
|
+
@JvmStatic
|
|
184
|
+
fun getChipName(): String {
|
|
185
|
+
return android.os.Build.HARDWARE
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Get total memory in bytes
|
|
190
|
+
*/
|
|
191
|
+
@JvmStatic
|
|
192
|
+
fun getTotalMemory(): Long {
|
|
193
|
+
// Try ActivityManager first (needs Context)
|
|
194
|
+
val context = SecureStorageManager.getContext()
|
|
195
|
+
if (context != null) {
|
|
196
|
+
try {
|
|
197
|
+
val activityManager = context.getSystemService(android.content.Context.ACTIVITY_SERVICE) as? android.app.ActivityManager
|
|
198
|
+
val memInfo = android.app.ActivityManager.MemoryInfo()
|
|
199
|
+
activityManager?.getMemoryInfo(memInfo)
|
|
200
|
+
if (memInfo.totalMem > 0) {
|
|
201
|
+
return memInfo.totalMem
|
|
202
|
+
}
|
|
203
|
+
} catch (e: Exception) {
|
|
204
|
+
Log.w(TAG, "getTotalMemory via ActivityManager failed: ${e.message}")
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Fallback: Read from /proc/meminfo (works without Context)
|
|
209
|
+
try {
|
|
210
|
+
val memInfoFile = java.io.File("/proc/meminfo")
|
|
211
|
+
if (memInfoFile.exists()) {
|
|
212
|
+
memInfoFile.bufferedReader().use { reader ->
|
|
213
|
+
val line = reader.readLine() // First line: MemTotal: ...
|
|
214
|
+
if (line != null && line.startsWith("MemTotal:")) {
|
|
215
|
+
val parts = line.split("\\s+".toRegex())
|
|
216
|
+
if (parts.size >= 2) {
|
|
217
|
+
val kB = parts[1].toLongOrNull() ?: 0L
|
|
218
|
+
return kB * 1024 // Convert KB to bytes
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
} catch (e: Exception) {
|
|
224
|
+
Log.w(TAG, "getTotalMemory via /proc/meminfo failed: ${e.message}")
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Last resort: Return a reasonable default for modern phones (4GB)
|
|
228
|
+
return 4L * 1024 * 1024 * 1024
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Get available memory in bytes
|
|
233
|
+
*/
|
|
234
|
+
@JvmStatic
|
|
235
|
+
fun getAvailableMemory(): Long {
|
|
236
|
+
// Try ActivityManager first (needs Context)
|
|
237
|
+
val context = SecureStorageManager.getContext()
|
|
238
|
+
if (context != null) {
|
|
239
|
+
try {
|
|
240
|
+
val activityManager = context.getSystemService(android.content.Context.ACTIVITY_SERVICE) as? android.app.ActivityManager
|
|
241
|
+
val memInfo = android.app.ActivityManager.MemoryInfo()
|
|
242
|
+
activityManager?.getMemoryInfo(memInfo)
|
|
243
|
+
if (memInfo.availMem > 0) {
|
|
244
|
+
return memInfo.availMem
|
|
245
|
+
}
|
|
246
|
+
} catch (e: Exception) {
|
|
247
|
+
Log.w(TAG, "getAvailableMemory via ActivityManager failed: ${e.message}")
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Fallback: Read from /proc/meminfo (works without Context)
|
|
252
|
+
try {
|
|
253
|
+
val memInfoFile = java.io.File("/proc/meminfo")
|
|
254
|
+
if (memInfoFile.exists()) {
|
|
255
|
+
memInfoFile.bufferedReader().use { reader ->
|
|
256
|
+
var line = reader.readLine()
|
|
257
|
+
while (line != null) {
|
|
258
|
+
if (line.startsWith("MemAvailable:")) {
|
|
259
|
+
val parts = line.split("\\s+".toRegex())
|
|
260
|
+
if (parts.size >= 2) {
|
|
261
|
+
val kB = parts[1].toLongOrNull() ?: 0L
|
|
262
|
+
return kB * 1024 // Convert KB to bytes
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
line = reader.readLine()
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
} catch (e: Exception) {
|
|
270
|
+
Log.w(TAG, "getAvailableMemory via /proc/meminfo failed: ${e.message}")
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Last resort: Return half of total as estimate
|
|
274
|
+
return getTotalMemory() / 2
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Get CPU core count
|
|
279
|
+
*/
|
|
280
|
+
@JvmStatic
|
|
281
|
+
fun getCoreCount(): Int {
|
|
282
|
+
return Runtime.getRuntime().availableProcessors()
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Get architecture (e.g., "arm64-v8a")
|
|
287
|
+
*/
|
|
288
|
+
@JvmStatic
|
|
289
|
+
fun getArchitecture(): String {
|
|
290
|
+
return android.os.Build.SUPPORTED_ABIS.firstOrNull() ?: "unknown"
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Get GPU family based on chip name
|
|
295
|
+
* Infers GPU vendor from known chip manufacturers:
|
|
296
|
+
* - Google Tensor/Pixel → Mali
|
|
297
|
+
* - Samsung Exynos → Mali
|
|
298
|
+
* - Qualcomm Snapdragon → Adreno
|
|
299
|
+
* - MediaTek → Mali (mostly)
|
|
300
|
+
* - HiSilicon Kirin → Mali
|
|
301
|
+
*
|
|
302
|
+
* Aligned with Kotlin SDK's CppBridgeDevice.getDefaultGPUFamily()
|
|
303
|
+
*/
|
|
304
|
+
@JvmStatic
|
|
305
|
+
fun getGPUFamily(): String {
|
|
306
|
+
val chipName = getChipName().lowercase()
|
|
307
|
+
val manufacturer = android.os.Build.MANUFACTURER.lowercase()
|
|
308
|
+
|
|
309
|
+
return when {
|
|
310
|
+
// Google Pixel codenames (all use Mali GPUs from Samsung/Google Tensor)
|
|
311
|
+
chipName == "bluejay" -> "mali" // Pixel 6a (Tensor)
|
|
312
|
+
chipName == "oriole" -> "mali" // Pixel 6 (Tensor)
|
|
313
|
+
chipName == "raven" -> "mali" // Pixel 6 Pro (Tensor)
|
|
314
|
+
chipName == "cheetah" -> "mali" // Pixel 7 (Tensor G2)
|
|
315
|
+
chipName == "panther" -> "mali" // Pixel 7 Pro (Tensor G2)
|
|
316
|
+
chipName == "lynx" -> "mali" // Pixel 7a (Tensor G2)
|
|
317
|
+
chipName == "tangorpro" -> "mali" // Pixel Tablet (Tensor G2)
|
|
318
|
+
chipName == "shiba" -> "mali" // Pixel 8 (Tensor G3)
|
|
319
|
+
chipName == "husky" -> "mali" // Pixel 8 Pro (Tensor G3)
|
|
320
|
+
chipName == "akita" -> "mali" // Pixel 8a (Tensor G3)
|
|
321
|
+
chipName == "caiman" -> "mali" // Pixel 9 (Tensor G4)
|
|
322
|
+
chipName == "komodo" -> "mali" // Pixel 9 Pro (Tensor G4)
|
|
323
|
+
chipName == "comet" -> "mali" // Pixel 9 Pro XL (Tensor G4)
|
|
324
|
+
chipName == "tokay" -> "mali" // Pixel 9 Pro Fold (Tensor G4)
|
|
325
|
+
|
|
326
|
+
// Google Tensor generic patterns
|
|
327
|
+
chipName.contains("tensor") -> "mali"
|
|
328
|
+
chipName.contains("gs1") -> "mali" // GS101 (Tensor)
|
|
329
|
+
chipName.contains("gs2") -> "mali" // GS201 (Tensor G2)
|
|
330
|
+
chipName.contains("zuma") -> "mali" // Zuma (Tensor G3)
|
|
331
|
+
manufacturer == "google" -> "mali" // Default for Google devices
|
|
332
|
+
|
|
333
|
+
// Samsung Exynos uses Mali GPUs
|
|
334
|
+
chipName.contains("exynos") -> "mali"
|
|
335
|
+
chipName.startsWith("s5e") -> "mali" // Samsung internal naming (e.g., s5e8535)
|
|
336
|
+
chipName.contains("samsung") -> "mali"
|
|
337
|
+
|
|
338
|
+
// Qualcomm Snapdragon uses Adreno GPUs
|
|
339
|
+
chipName.contains("snapdragon") -> "adreno"
|
|
340
|
+
chipName.contains("qualcomm") -> "adreno"
|
|
341
|
+
chipName.contains("sdm") -> "adreno" // SDM845, SDM855, etc.
|
|
342
|
+
chipName.contains("sm8") -> "adreno" // SM8150, SM8250, etc.
|
|
343
|
+
chipName.contains("sm7") -> "adreno" // SM7150, etc.
|
|
344
|
+
chipName.contains("sm6") -> "adreno" // SM6150, etc.
|
|
345
|
+
chipName.contains("msm") -> "adreno" // Older MSM chips
|
|
346
|
+
chipName.contains("kona") -> "adreno" // Snapdragon 865
|
|
347
|
+
chipName.contains("lahaina") -> "adreno" // Snapdragon 888
|
|
348
|
+
chipName.contains("taro") -> "adreno" // Snapdragon 8 Gen 1
|
|
349
|
+
chipName.contains("kalama") -> "adreno" // Snapdragon 8 Gen 2
|
|
350
|
+
chipName.contains("pineapple") -> "adreno" // Snapdragon 8 Gen 3
|
|
351
|
+
manufacturer == "qualcomm" -> "adreno"
|
|
352
|
+
|
|
353
|
+
// MediaTek uses Mali GPUs (mostly)
|
|
354
|
+
chipName.contains("mediatek") -> "mali"
|
|
355
|
+
chipName.contains("mt6") -> "mali" // MT6xxx series
|
|
356
|
+
chipName.contains("mt8") -> "mali" // MT8xxx series
|
|
357
|
+
chipName.contains("dimensity") -> "mali"
|
|
358
|
+
chipName.contains("helio") -> "mali"
|
|
359
|
+
|
|
360
|
+
// HiSilicon Kirin uses Mali GPUs
|
|
361
|
+
chipName.contains("kirin") -> "mali"
|
|
362
|
+
chipName.contains("hisilicon") -> "mali"
|
|
363
|
+
|
|
364
|
+
// Intel/x86 GPUs
|
|
365
|
+
chipName.contains("intel") -> "intel"
|
|
366
|
+
|
|
367
|
+
// NVIDIA (rare on mobile)
|
|
368
|
+
chipName.contains("nvidia") -> "nvidia"
|
|
369
|
+
chipName.contains("tegra") -> "nvidia"
|
|
370
|
+
|
|
371
|
+
else -> "unknown"
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Check if device is a tablet
|
|
377
|
+
* Uses screen size configuration to determine form factor
|
|
378
|
+
* Matches Swift SDK: device.userInterfaceIdiom == .pad
|
|
379
|
+
*/
|
|
380
|
+
@JvmStatic
|
|
381
|
+
fun isTablet(): Boolean {
|
|
382
|
+
val context = SecureStorageManager.getContext()
|
|
383
|
+
if (context != null) {
|
|
384
|
+
val screenLayout = context.resources.configuration.screenLayout and
|
|
385
|
+
android.content.res.Configuration.SCREENLAYOUT_SIZE_MASK
|
|
386
|
+
return screenLayout >= android.content.res.Configuration.SCREENLAYOUT_SIZE_LARGE
|
|
387
|
+
}
|
|
388
|
+
// Fallback: Check display metrics if context unavailable
|
|
389
|
+
return false
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
package com.margelo.nitro.runanywhere
|
|
2
|
+
|
|
3
|
+
import android.util.Log
|
|
4
|
+
import com.facebook.react.BaseReactPackage
|
|
5
|
+
import com.facebook.react.bridge.NativeModule
|
|
6
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
7
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
8
|
+
|
|
9
|
+
class RunAnywhereCorePackage : BaseReactPackage() {
|
|
10
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
11
|
+
// Initialize secure storage with application context
|
|
12
|
+
SecureStorageManager.initialize(reactContext.applicationContext)
|
|
13
|
+
return null
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
17
|
+
return ReactModuleInfoProvider { HashMap() }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
companion object {
|
|
21
|
+
private const val TAG = "RunAnywhereCorePackage"
|
|
22
|
+
|
|
23
|
+
init {
|
|
24
|
+
System.loadLibrary("runanywherecore")
|
|
25
|
+
Log.i(TAG, "Loaded native library: runanywherecore")
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|