@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
package/src/index.ts
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @runanywhere/core - Core SDK for RunAnywhere React Native
|
|
3
|
+
*
|
|
4
|
+
* Core SDK that includes:
|
|
5
|
+
* - RACommons bindings via Nitrogen HybridObject
|
|
6
|
+
* - Authentication, Device Registration
|
|
7
|
+
* - Model Registry, Download Service
|
|
8
|
+
* - Storage, Events, HTTP Client
|
|
9
|
+
*
|
|
10
|
+
* NO LLM/STT/TTS/VAD functionality - use:
|
|
11
|
+
* - @runanywhere/llamacpp for text generation
|
|
12
|
+
* - @runanywhere/onnx for speech processing
|
|
13
|
+
*
|
|
14
|
+
* @packageDocumentation
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// =============================================================================
|
|
18
|
+
// Main SDK
|
|
19
|
+
// =============================================================================
|
|
20
|
+
|
|
21
|
+
export { RunAnywhere } from './Public/RunAnywhere';
|
|
22
|
+
|
|
23
|
+
// =============================================================================
|
|
24
|
+
// Types
|
|
25
|
+
// =============================================================================
|
|
26
|
+
|
|
27
|
+
export * from './types';
|
|
28
|
+
|
|
29
|
+
// =============================================================================
|
|
30
|
+
// Foundation - Error Types
|
|
31
|
+
// =============================================================================
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
// Error Codes
|
|
35
|
+
ErrorCode,
|
|
36
|
+
getErrorCodeMessage,
|
|
37
|
+
// Error Category
|
|
38
|
+
ErrorCategory,
|
|
39
|
+
allErrorCategories,
|
|
40
|
+
getCategoryFromCode,
|
|
41
|
+
inferCategoryFromError,
|
|
42
|
+
// Error Context
|
|
43
|
+
type ErrorContext,
|
|
44
|
+
createErrorContext,
|
|
45
|
+
formatStackTrace,
|
|
46
|
+
formatLocation,
|
|
47
|
+
formatContext,
|
|
48
|
+
ContextualError,
|
|
49
|
+
withContext,
|
|
50
|
+
getErrorContext,
|
|
51
|
+
getUnderlyingError,
|
|
52
|
+
// SDKError
|
|
53
|
+
SDKErrorCode,
|
|
54
|
+
type SDKErrorProtocol,
|
|
55
|
+
SDKError,
|
|
56
|
+
asSDKError,
|
|
57
|
+
isSDKError,
|
|
58
|
+
captureAndThrow,
|
|
59
|
+
notInitializedError,
|
|
60
|
+
alreadyInitializedError,
|
|
61
|
+
invalidInputError,
|
|
62
|
+
modelNotFoundError,
|
|
63
|
+
modelLoadError,
|
|
64
|
+
networkError,
|
|
65
|
+
authenticationError,
|
|
66
|
+
generationError,
|
|
67
|
+
storageError,
|
|
68
|
+
} from './Foundation/ErrorTypes';
|
|
69
|
+
|
|
70
|
+
// =============================================================================
|
|
71
|
+
// Foundation - Initialization
|
|
72
|
+
// =============================================================================
|
|
73
|
+
|
|
74
|
+
export {
|
|
75
|
+
InitializationPhase,
|
|
76
|
+
type SDKInitParams,
|
|
77
|
+
type InitializationState,
|
|
78
|
+
isSDKUsable,
|
|
79
|
+
areServicesReady,
|
|
80
|
+
isInitializing,
|
|
81
|
+
createInitialState,
|
|
82
|
+
markCoreInitialized,
|
|
83
|
+
markServicesInitializing,
|
|
84
|
+
markServicesInitialized,
|
|
85
|
+
markInitializationFailed,
|
|
86
|
+
resetState,
|
|
87
|
+
} from './Foundation/Initialization';
|
|
88
|
+
|
|
89
|
+
// =============================================================================
|
|
90
|
+
// Foundation - Security
|
|
91
|
+
// =============================================================================
|
|
92
|
+
|
|
93
|
+
export {
|
|
94
|
+
SecureStorageKeys,
|
|
95
|
+
SecureStorageService,
|
|
96
|
+
type SecureStorageErrorCode,
|
|
97
|
+
SecureStorageError,
|
|
98
|
+
isSecureStorageError,
|
|
99
|
+
isItemNotFoundError,
|
|
100
|
+
DeviceIdentity,
|
|
101
|
+
} from './Foundation/Security';
|
|
102
|
+
|
|
103
|
+
// =============================================================================
|
|
104
|
+
// Foundation - Constants
|
|
105
|
+
// =============================================================================
|
|
106
|
+
|
|
107
|
+
export { SDKConstants } from './Foundation/Constants';
|
|
108
|
+
|
|
109
|
+
// =============================================================================
|
|
110
|
+
// Foundation - Logging
|
|
111
|
+
// =============================================================================
|
|
112
|
+
|
|
113
|
+
export { SDKLogger } from './Foundation/Logging/Logger/SDKLogger';
|
|
114
|
+
export { LogLevel } from './Foundation/Logging/Models/LogLevel';
|
|
115
|
+
export { LoggingManager } from './Foundation/Logging/Services/LoggingManager';
|
|
116
|
+
|
|
117
|
+
// =============================================================================
|
|
118
|
+
// Foundation - DI
|
|
119
|
+
// =============================================================================
|
|
120
|
+
|
|
121
|
+
export { ServiceRegistry } from './Foundation/DependencyInjection/ServiceRegistry';
|
|
122
|
+
export { ServiceContainer } from './Foundation/DependencyInjection/ServiceContainer';
|
|
123
|
+
|
|
124
|
+
// =============================================================================
|
|
125
|
+
// Events
|
|
126
|
+
// =============================================================================
|
|
127
|
+
|
|
128
|
+
export { EventBus, NativeEventNames } from './Public/Events';
|
|
129
|
+
export {
|
|
130
|
+
type SDKEvent,
|
|
131
|
+
EventDestination,
|
|
132
|
+
EventCategory,
|
|
133
|
+
createSDKEvent,
|
|
134
|
+
isSDKEvent,
|
|
135
|
+
EventPublisher,
|
|
136
|
+
} from './Infrastructure/Events';
|
|
137
|
+
|
|
138
|
+
// =============================================================================
|
|
139
|
+
// Services (thin wrappers over native)
|
|
140
|
+
// =============================================================================
|
|
141
|
+
|
|
142
|
+
export {
|
|
143
|
+
ModelRegistry,
|
|
144
|
+
FileSystem,
|
|
145
|
+
DownloadService,
|
|
146
|
+
DownloadState,
|
|
147
|
+
SystemTTSService,
|
|
148
|
+
getVoicesByLanguage,
|
|
149
|
+
getDefaultVoice,
|
|
150
|
+
getPlatformDefaultVoice,
|
|
151
|
+
PlatformVoices,
|
|
152
|
+
type ModelCriteria,
|
|
153
|
+
type AddModelFromURLOptions,
|
|
154
|
+
type DownloadProgress,
|
|
155
|
+
type DownloadTask,
|
|
156
|
+
type DownloadConfiguration,
|
|
157
|
+
type ProgressCallback,
|
|
158
|
+
} from './services';
|
|
159
|
+
|
|
160
|
+
// =============================================================================
|
|
161
|
+
// Network Layer - Using axios (industry standard HTTP library)
|
|
162
|
+
// =============================================================================
|
|
163
|
+
|
|
164
|
+
export {
|
|
165
|
+
// HTTP Service
|
|
166
|
+
HTTPService,
|
|
167
|
+
// Configuration
|
|
168
|
+
SDKEnvironment,
|
|
169
|
+
createNetworkConfig,
|
|
170
|
+
getEnvironmentName,
|
|
171
|
+
isDevelopment,
|
|
172
|
+
isProduction,
|
|
173
|
+
DEFAULT_BASE_URL,
|
|
174
|
+
DEFAULT_TIMEOUT_MS,
|
|
175
|
+
// Telemetry
|
|
176
|
+
TelemetryService,
|
|
177
|
+
TelemetryCategory,
|
|
178
|
+
// Endpoints
|
|
179
|
+
APIEndpoints,
|
|
180
|
+
} from './services';
|
|
181
|
+
|
|
182
|
+
export type {
|
|
183
|
+
HTTPServiceConfig,
|
|
184
|
+
DevModeConfig,
|
|
185
|
+
NetworkConfig,
|
|
186
|
+
TelemetryEvent,
|
|
187
|
+
APIEndpointKey,
|
|
188
|
+
APIEndpointValue,
|
|
189
|
+
} from './services';
|
|
190
|
+
|
|
191
|
+
// =============================================================================
|
|
192
|
+
// Features
|
|
193
|
+
// =============================================================================
|
|
194
|
+
|
|
195
|
+
export {
|
|
196
|
+
AudioCaptureManager,
|
|
197
|
+
AudioPlaybackManager,
|
|
198
|
+
VoiceSessionHandle,
|
|
199
|
+
DEFAULT_VOICE_SESSION_CONFIG,
|
|
200
|
+
} from './Features';
|
|
201
|
+
export type {
|
|
202
|
+
AudioDataCallback,
|
|
203
|
+
AudioLevelCallback,
|
|
204
|
+
AudioCaptureConfig,
|
|
205
|
+
AudioCaptureState,
|
|
206
|
+
PlaybackState,
|
|
207
|
+
PlaybackCompletionCallback,
|
|
208
|
+
PlaybackErrorCallback,
|
|
209
|
+
PlaybackConfig,
|
|
210
|
+
VoiceSessionConfig,
|
|
211
|
+
VoiceSessionEvent,
|
|
212
|
+
VoiceSessionEventType,
|
|
213
|
+
VoiceSessionEventCallback,
|
|
214
|
+
VoiceSessionState,
|
|
215
|
+
} from './Features';
|
|
216
|
+
|
|
217
|
+
// =============================================================================
|
|
218
|
+
// Native Module (now part of core)
|
|
219
|
+
// =============================================================================
|
|
220
|
+
|
|
221
|
+
export {
|
|
222
|
+
NativeRunAnywhereCore,
|
|
223
|
+
getNativeCoreModule,
|
|
224
|
+
requireNativeCoreModule,
|
|
225
|
+
isNativeCoreModuleAvailable,
|
|
226
|
+
// Backwards compatibility exports (match old @runanywhere/native)
|
|
227
|
+
requireNativeModule,
|
|
228
|
+
isNativeModuleAvailable,
|
|
229
|
+
requireDeviceInfoModule,
|
|
230
|
+
requireFileSystemModule,
|
|
231
|
+
} from './native/NativeRunAnywhereCore';
|
|
232
|
+
export type { NativeRunAnywhereCoreModule, FileSystemModule } from './native/NativeRunAnywhereCore';
|
|
233
|
+
|
|
234
|
+
// =============================================================================
|
|
235
|
+
// Nitrogen Spec Types
|
|
236
|
+
// =============================================================================
|
|
237
|
+
|
|
238
|
+
export type { RunAnywhereCore } from './specs/RunAnywhereCore.nitro';
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NativeRunAnywhereCore.ts
|
|
3
|
+
*
|
|
4
|
+
* Exports the native RunAnywhereCore Hybrid Object from Nitro Modules.
|
|
5
|
+
* This module provides core SDK functionality without any inference backends.
|
|
6
|
+
*
|
|
7
|
+
* For LLM, STT, TTS, VAD capabilities, use the separate packages:
|
|
8
|
+
* - @runanywhere/llamacpp for text generation
|
|
9
|
+
* - @runanywhere/onnx for speech processing
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
13
|
+
import type { RunAnywhereCore } from '../specs/RunAnywhereCore.nitro';
|
|
14
|
+
import type { RunAnywhereDeviceInfo } from '../specs/RunAnywhereDeviceInfo.nitro';
|
|
15
|
+
import type { NativeRunAnywhereModule } from './NativeRunAnywhereModule';
|
|
16
|
+
import { SDKLogger } from '../Foundation/Logging';
|
|
17
|
+
|
|
18
|
+
export type { NativeRunAnywhereModule } from './NativeRunAnywhereModule';
|
|
19
|
+
export { hasNativeMethod } from './NativeRunAnywhereModule';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The native RunAnywhereCore module type
|
|
23
|
+
*/
|
|
24
|
+
export type NativeRunAnywhereCoreModule = RunAnywhereCore;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Get the native RunAnywhereCore Hybrid Object
|
|
28
|
+
*
|
|
29
|
+
* This provides direct access to the native module.
|
|
30
|
+
* Most users should use the RunAnywhere facade class instead.
|
|
31
|
+
*/
|
|
32
|
+
export function requireNativeCoreModule(): NativeRunAnywhereCoreModule {
|
|
33
|
+
return NitroModules.createHybridObject<RunAnywhereCore>('RunAnywhereCore');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Check if the native core module is available
|
|
38
|
+
*/
|
|
39
|
+
export function isNativeCoreModuleAvailable(): boolean {
|
|
40
|
+
try {
|
|
41
|
+
requireNativeCoreModule();
|
|
42
|
+
return true;
|
|
43
|
+
} catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Singleton instance of the native module (lazy initialized)
|
|
50
|
+
*/
|
|
51
|
+
let _nativeModule: NativeRunAnywhereModule | undefined;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Get the singleton native module instance
|
|
55
|
+
* Returns the full module type for backwards compatibility
|
|
56
|
+
*/
|
|
57
|
+
export function getNativeCoreModule(): NativeRunAnywhereModule {
|
|
58
|
+
if (!_nativeModule) {
|
|
59
|
+
// Cast to full module type - optional methods may not be available
|
|
60
|
+
_nativeModule = requireNativeCoreModule() as unknown as NativeRunAnywhereModule;
|
|
61
|
+
}
|
|
62
|
+
return _nativeModule;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// =============================================================================
|
|
66
|
+
// Backwards compatibility exports
|
|
67
|
+
// These match the old @runanywhere/native exports
|
|
68
|
+
// =============================================================================
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Get the native module with full API type
|
|
72
|
+
* Some methods may not be available unless backend packages are installed
|
|
73
|
+
*/
|
|
74
|
+
export function requireNativeModule(): NativeRunAnywhereModule {
|
|
75
|
+
return getNativeCoreModule();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Check if native module is available
|
|
80
|
+
*/
|
|
81
|
+
export function isNativeModuleAvailable(): boolean {
|
|
82
|
+
return isNativeCoreModuleAvailable();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Device info module interface
|
|
87
|
+
*/
|
|
88
|
+
export interface DeviceInfoModule {
|
|
89
|
+
deviceId: string;
|
|
90
|
+
getDeviceIdSync: () => string;
|
|
91
|
+
uniqueId: string;
|
|
92
|
+
getDeviceModel: () => Promise<string>;
|
|
93
|
+
getChipName: () => Promise<string>;
|
|
94
|
+
getTotalRAM: () => Promise<number>;
|
|
95
|
+
getAvailableRAM: () => Promise<number>;
|
|
96
|
+
hasNPU: () => Promise<boolean>;
|
|
97
|
+
getOSVersion: () => Promise<string>;
|
|
98
|
+
hasGPU: () => Promise<boolean>;
|
|
99
|
+
getCPUCores: () => Promise<number>;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Singleton for device info hybrid object
|
|
104
|
+
*/
|
|
105
|
+
let _deviceInfoModule: RunAnywhereDeviceInfo | null = null;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Get the RunAnywhereDeviceInfo hybrid object
|
|
109
|
+
* This provides real device info from native iOS/Android code
|
|
110
|
+
*/
|
|
111
|
+
function getDeviceInfoHybridObject(): RunAnywhereDeviceInfo | null {
|
|
112
|
+
if (_deviceInfoModule) {
|
|
113
|
+
return _deviceInfoModule;
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
_deviceInfoModule = NitroModules.createHybridObject<RunAnywhereDeviceInfo>('RunAnywhereDeviceInfo');
|
|
117
|
+
return _deviceInfoModule;
|
|
118
|
+
} catch (error) {
|
|
119
|
+
console.warn('[NativeRunAnywhereCore] Failed to create RunAnywhereDeviceInfo:', error);
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Device info module - provides device information
|
|
126
|
+
*
|
|
127
|
+
* Uses the RunAnywhereDeviceInfo NitroModule for real device info
|
|
128
|
+
* from native iOS (Swift) and Android (Kotlin) implementations.
|
|
129
|
+
*/
|
|
130
|
+
export function requireDeviceInfoModule(): DeviceInfoModule {
|
|
131
|
+
const deviceInfo = getDeviceInfoHybridObject();
|
|
132
|
+
|
|
133
|
+
return {
|
|
134
|
+
deviceId: '',
|
|
135
|
+
getDeviceIdSync: () => '',
|
|
136
|
+
uniqueId: '',
|
|
137
|
+
|
|
138
|
+
getDeviceModel: async () => {
|
|
139
|
+
if (deviceInfo) {
|
|
140
|
+
try {
|
|
141
|
+
return await deviceInfo.getDeviceModel();
|
|
142
|
+
} catch (error) {
|
|
143
|
+
console.warn('[DeviceInfo] getDeviceModel failed:', error);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return 'Unknown Device';
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
getChipName: async () => {
|
|
150
|
+
if (deviceInfo) {
|
|
151
|
+
try {
|
|
152
|
+
return await deviceInfo.getChipName();
|
|
153
|
+
} catch (error) {
|
|
154
|
+
console.warn('[DeviceInfo] getChipName failed:', error);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return 'Unknown';
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
getTotalRAM: async () => {
|
|
161
|
+
if (deviceInfo) {
|
|
162
|
+
try {
|
|
163
|
+
return await deviceInfo.getTotalRAM();
|
|
164
|
+
} catch (error) {
|
|
165
|
+
console.warn('[DeviceInfo] getTotalRAM failed:', error);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return 0;
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
getAvailableRAM: async () => {
|
|
172
|
+
if (deviceInfo) {
|
|
173
|
+
try {
|
|
174
|
+
return await deviceInfo.getAvailableRAM();
|
|
175
|
+
} catch (error) {
|
|
176
|
+
console.warn('[DeviceInfo] getAvailableRAM failed:', error);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return 0;
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
hasNPU: async () => {
|
|
183
|
+
if (deviceInfo) {
|
|
184
|
+
try {
|
|
185
|
+
return await deviceInfo.hasNPU();
|
|
186
|
+
} catch (error) {
|
|
187
|
+
console.warn('[DeviceInfo] hasNPU failed:', error);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return false;
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
getOSVersion: async () => {
|
|
194
|
+
if (deviceInfo) {
|
|
195
|
+
try {
|
|
196
|
+
return await deviceInfo.getOSVersion();
|
|
197
|
+
} catch (error) {
|
|
198
|
+
console.warn('[DeviceInfo] getOSVersion failed:', error);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return 'Unknown';
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
hasGPU: async () => {
|
|
205
|
+
if (deviceInfo) {
|
|
206
|
+
try {
|
|
207
|
+
return await deviceInfo.hasGPU();
|
|
208
|
+
} catch (error) {
|
|
209
|
+
console.warn('[DeviceInfo] hasGPU failed:', error);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return false;
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
getCPUCores: async () => {
|
|
216
|
+
if (deviceInfo) {
|
|
217
|
+
try {
|
|
218
|
+
return await deviceInfo.getCPUCores();
|
|
219
|
+
} catch (error) {
|
|
220
|
+
console.warn('[DeviceInfo] getCPUCores failed:', error);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return 0;
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* File system module interface
|
|
230
|
+
*/
|
|
231
|
+
export interface FileSystemModule {
|
|
232
|
+
getAvailableDiskSpace(): Promise<number>;
|
|
233
|
+
getTotalDiskSpace(): Promise<number>;
|
|
234
|
+
downloadModel(
|
|
235
|
+
fileName: string,
|
|
236
|
+
url: string,
|
|
237
|
+
onProgress?: (progress: number) => void
|
|
238
|
+
): Promise<boolean>;
|
|
239
|
+
getModelPath(fileName: string): Promise<string>;
|
|
240
|
+
modelExists(fileName: string): Promise<boolean>;
|
|
241
|
+
deleteModel(fileName: string): Promise<boolean>;
|
|
242
|
+
getDataDirectory(): Promise<string>;
|
|
243
|
+
getModelsDirectory(): Promise<string>;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Get the file system module for model downloads and file operations
|
|
248
|
+
* Uses react-native-fs for cross-platform file operations
|
|
249
|
+
*/
|
|
250
|
+
export function requireFileSystemModule(): FileSystemModule {
|
|
251
|
+
// Import the FileSystem service
|
|
252
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
253
|
+
const { FileSystem } = require('../services/FileSystem');
|
|
254
|
+
|
|
255
|
+
return {
|
|
256
|
+
getAvailableDiskSpace: () => FileSystem.getAvailableDiskSpace(),
|
|
257
|
+
getTotalDiskSpace: () => FileSystem.getTotalDiskSpace(),
|
|
258
|
+
downloadModel: async (
|
|
259
|
+
fileName: string,
|
|
260
|
+
url: string,
|
|
261
|
+
onProgress?: (progress: number) => void
|
|
262
|
+
): Promise<boolean> => {
|
|
263
|
+
try {
|
|
264
|
+
await FileSystem.downloadModel(fileName, url, (progress: { progress: number }) => {
|
|
265
|
+
if (onProgress) {
|
|
266
|
+
onProgress(progress.progress);
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
return true;
|
|
270
|
+
} catch (error) {
|
|
271
|
+
SDKLogger.download.logError(error as Error, 'Download failed');
|
|
272
|
+
return false;
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
getModelPath: (fileName: string) => FileSystem.getModelPath(fileName),
|
|
276
|
+
modelExists: (fileName: string) => FileSystem.modelExists(fileName),
|
|
277
|
+
deleteModel: (fileName: string) => FileSystem.deleteModel(fileName),
|
|
278
|
+
getDataDirectory: () => Promise.resolve(FileSystem.getRunAnywhereDirectory()),
|
|
279
|
+
getModelsDirectory: () => Promise.resolve(FileSystem.getModelsDirectory()),
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Default export - the native module getter
|
|
285
|
+
*/
|
|
286
|
+
export const NativeRunAnywhereCore = {
|
|
287
|
+
get: getNativeCoreModule,
|
|
288
|
+
isAvailable: isNativeCoreModuleAvailable,
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
export default NativeRunAnywhereCore;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NativeRunAnywhereModule.ts
|
|
3
|
+
*
|
|
4
|
+
* Full native module type that includes all methods from core.
|
|
5
|
+
* All methods call backend-agnostic C++ APIs (rac_*_component_*).
|
|
6
|
+
*
|
|
7
|
+
* LLM, STT, TTS, VAD methods are backend-agnostic:
|
|
8
|
+
* - They call the C++ rac_*_component_* APIs
|
|
9
|
+
* - The actual backend is registered by importing backend packages:
|
|
10
|
+
* - @runanywhere/llamacpp registers the LLM backend
|
|
11
|
+
* - @runanywhere/onnx registers the STT/TTS/VAD backends
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type { RunAnywhereCore } from '../specs/RunAnywhereCore.nitro';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Native module type - directly matches RunAnywhereCore spec
|
|
18
|
+
*
|
|
19
|
+
* All methods are backend-agnostic. If no backend is registered for a
|
|
20
|
+
* capability, the methods will throw appropriate errors.
|
|
21
|
+
*/
|
|
22
|
+
export type NativeRunAnywhereModule = RunAnywhereCore;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Type guard to check if a method is available on the native module
|
|
26
|
+
*/
|
|
27
|
+
export function hasNativeMethod<K extends keyof NativeRunAnywhereModule>(
|
|
28
|
+
native: NativeRunAnywhereModule,
|
|
29
|
+
method: K
|
|
30
|
+
): boolean {
|
|
31
|
+
return typeof native[method] === 'function';
|
|
32
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native module exports for @runanywhere/core
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
NativeRunAnywhereCore,
|
|
7
|
+
getNativeCoreModule,
|
|
8
|
+
requireNativeCoreModule,
|
|
9
|
+
isNativeCoreModuleAvailable,
|
|
10
|
+
// Backwards compatibility
|
|
11
|
+
requireNativeModule,
|
|
12
|
+
isNativeModuleAvailable,
|
|
13
|
+
requireDeviceInfoModule,
|
|
14
|
+
requireFileSystemModule,
|
|
15
|
+
hasNativeMethod,
|
|
16
|
+
} from './NativeRunAnywhereCore';
|
|
17
|
+
export type {
|
|
18
|
+
NativeRunAnywhereCoreModule,
|
|
19
|
+
NativeRunAnywhereModule,
|
|
20
|
+
FileSystemModule,
|
|
21
|
+
} from './NativeRunAnywhereCore';
|