@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,340 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file rac_platform_adapter.h
|
|
3
|
+
* @brief RunAnywhere Commons - Platform Adapter Interface
|
|
4
|
+
*
|
|
5
|
+
* Platform adapter provides callbacks for platform-specific operations.
|
|
6
|
+
* Swift/Kotlin SDK implements these callbacks and passes them during init.
|
|
7
|
+
*
|
|
8
|
+
* NOTE: HTTP networking is delegated to the platform layer (Swift/Kotlin).
|
|
9
|
+
* The C++ layer only handles orchestration logic.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
#ifndef RAC_PLATFORM_ADAPTER_H
|
|
13
|
+
#define RAC_PLATFORM_ADAPTER_H
|
|
14
|
+
|
|
15
|
+
#include <RACommons/rac_error.h>
|
|
16
|
+
#include <RACommons/rac_types.h>
|
|
17
|
+
#include <RACommons/rac_model_types.h>
|
|
18
|
+
|
|
19
|
+
#ifdef __cplusplus
|
|
20
|
+
extern "C" {
|
|
21
|
+
#endif
|
|
22
|
+
|
|
23
|
+
// =============================================================================
|
|
24
|
+
// CALLBACK TYPES (defined outside struct for C compatibility)
|
|
25
|
+
// =============================================================================
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* HTTP download progress callback type.
|
|
29
|
+
* @param bytes_downloaded Bytes downloaded so far
|
|
30
|
+
* @param total_bytes Total bytes to download (0 if unknown)
|
|
31
|
+
* @param callback_user_data Context passed to http_download
|
|
32
|
+
*/
|
|
33
|
+
typedef void (*rac_http_progress_callback_fn)(int64_t bytes_downloaded, int64_t total_bytes,
|
|
34
|
+
void* callback_user_data);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* HTTP download completion callback type.
|
|
38
|
+
* @param result RAC_SUCCESS or error code
|
|
39
|
+
* @param downloaded_path Path to downloaded file (NULL on failure)
|
|
40
|
+
* @param callback_user_data Context passed to http_download
|
|
41
|
+
*/
|
|
42
|
+
typedef void (*rac_http_complete_callback_fn)(rac_result_t result, const char* downloaded_path,
|
|
43
|
+
void* callback_user_data);
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Archive extraction progress callback type.
|
|
47
|
+
* @param files_extracted Number of files extracted so far
|
|
48
|
+
* @param total_files Total files to extract
|
|
49
|
+
* @param callback_user_data Context passed to extract_archive
|
|
50
|
+
*/
|
|
51
|
+
typedef void (*rac_extract_progress_callback_fn)(int32_t files_extracted, int32_t total_files,
|
|
52
|
+
void* callback_user_data);
|
|
53
|
+
|
|
54
|
+
// =============================================================================
|
|
55
|
+
// PLATFORM ADAPTER STRUCTURE
|
|
56
|
+
// =============================================================================
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Platform adapter structure.
|
|
60
|
+
*
|
|
61
|
+
* Implements platform-specific operations via callbacks.
|
|
62
|
+
* The SDK layer (Swift/Kotlin) provides these implementations.
|
|
63
|
+
*/
|
|
64
|
+
typedef struct rac_platform_adapter {
|
|
65
|
+
// -------------------------------------------------------------------------
|
|
66
|
+
// File System Operations
|
|
67
|
+
// -------------------------------------------------------------------------
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Check if a file exists.
|
|
71
|
+
* @param path File path
|
|
72
|
+
* @param user_data Platform context
|
|
73
|
+
* @return RAC_TRUE if file exists, RAC_FALSE otherwise
|
|
74
|
+
*/
|
|
75
|
+
rac_bool_t (*file_exists)(const char* path, void* user_data);
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Read file contents.
|
|
79
|
+
* @param path File path
|
|
80
|
+
* @param out_data Output buffer (caller must free with rac_free)
|
|
81
|
+
* @param out_size Output file size
|
|
82
|
+
* @param user_data Platform context
|
|
83
|
+
* @return RAC_SUCCESS on success, error code on failure
|
|
84
|
+
*/
|
|
85
|
+
rac_result_t (*file_read)(const char* path, void** out_data, size_t* out_size, void* user_data);
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Write file contents.
|
|
89
|
+
* @param path File path
|
|
90
|
+
* @param data Data to write
|
|
91
|
+
* @param size Data size
|
|
92
|
+
* @param user_data Platform context
|
|
93
|
+
* @return RAC_SUCCESS on success, error code on failure
|
|
94
|
+
*/
|
|
95
|
+
rac_result_t (*file_write)(const char* path, const void* data, size_t size, void* user_data);
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Delete a file.
|
|
99
|
+
* @param path File path
|
|
100
|
+
* @param user_data Platform context
|
|
101
|
+
* @return RAC_SUCCESS on success, error code on failure
|
|
102
|
+
*/
|
|
103
|
+
rac_result_t (*file_delete)(const char* path, void* user_data);
|
|
104
|
+
|
|
105
|
+
// -------------------------------------------------------------------------
|
|
106
|
+
// Secure Storage (Keychain/KeyStore)
|
|
107
|
+
// -------------------------------------------------------------------------
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Get a value from secure storage.
|
|
111
|
+
* @param key Key name
|
|
112
|
+
* @param out_value Output value (caller must free with rac_free)
|
|
113
|
+
* @param user_data Platform context
|
|
114
|
+
* @return RAC_SUCCESS on success, RAC_ERROR_FILE_NOT_FOUND if not found
|
|
115
|
+
*/
|
|
116
|
+
rac_result_t (*secure_get)(const char* key, char** out_value, void* user_data);
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Set a value in secure storage.
|
|
120
|
+
* @param key Key name
|
|
121
|
+
* @param value Value to store
|
|
122
|
+
* @param user_data Platform context
|
|
123
|
+
* @return RAC_SUCCESS on success, error code on failure
|
|
124
|
+
*/
|
|
125
|
+
rac_result_t (*secure_set)(const char* key, const char* value, void* user_data);
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Delete a value from secure storage.
|
|
129
|
+
* @param key Key name
|
|
130
|
+
* @param user_data Platform context
|
|
131
|
+
* @return RAC_SUCCESS on success, error code on failure
|
|
132
|
+
*/
|
|
133
|
+
rac_result_t (*secure_delete)(const char* key, void* user_data);
|
|
134
|
+
|
|
135
|
+
// -------------------------------------------------------------------------
|
|
136
|
+
// Logging
|
|
137
|
+
// -------------------------------------------------------------------------
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Log a message.
|
|
141
|
+
* @param level Log level
|
|
142
|
+
* @param category Log category (e.g., "ModuleRegistry")
|
|
143
|
+
* @param message Log message
|
|
144
|
+
* @param user_data Platform context
|
|
145
|
+
*/
|
|
146
|
+
void (*log)(rac_log_level_t level, const char* category, const char* message, void* user_data);
|
|
147
|
+
|
|
148
|
+
// -------------------------------------------------------------------------
|
|
149
|
+
// Error Tracking (Optional - for Sentry/crash reporting)
|
|
150
|
+
// -------------------------------------------------------------------------
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Track a structured error for telemetry/crash reporting.
|
|
154
|
+
* Can be NULL - errors will still be logged but not sent to Sentry.
|
|
155
|
+
*
|
|
156
|
+
* Called for non-expected errors (i.e., not cancellations).
|
|
157
|
+
* The JSON string contains full error details including stack trace.
|
|
158
|
+
*
|
|
159
|
+
* @param error_json JSON representation of the structured error
|
|
160
|
+
* @param user_data Platform context
|
|
161
|
+
*/
|
|
162
|
+
void (*track_error)(const char* error_json, void* user_data);
|
|
163
|
+
|
|
164
|
+
// -------------------------------------------------------------------------
|
|
165
|
+
// Clock
|
|
166
|
+
// -------------------------------------------------------------------------
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Get current time in milliseconds since Unix epoch.
|
|
170
|
+
* @param user_data Platform context
|
|
171
|
+
* @return Current time in milliseconds
|
|
172
|
+
*/
|
|
173
|
+
int64_t (*now_ms)(void* user_data);
|
|
174
|
+
|
|
175
|
+
// -------------------------------------------------------------------------
|
|
176
|
+
// Memory Info
|
|
177
|
+
// -------------------------------------------------------------------------
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Get memory information.
|
|
181
|
+
* @param out_info Output memory info structure
|
|
182
|
+
* @param user_data Platform context
|
|
183
|
+
* @return RAC_SUCCESS on success, error code on failure
|
|
184
|
+
*/
|
|
185
|
+
rac_result_t (*get_memory_info)(rac_memory_info_t* out_info, void* user_data);
|
|
186
|
+
|
|
187
|
+
// -------------------------------------------------------------------------
|
|
188
|
+
// HTTP Download (Optional - can be NULL)
|
|
189
|
+
// -------------------------------------------------------------------------
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Start an HTTP download.
|
|
193
|
+
* Can be NULL - download orchestration in C++ will call back to Swift/Kotlin.
|
|
194
|
+
*
|
|
195
|
+
* @param url URL to download from
|
|
196
|
+
* @param destination_path Where to save the downloaded file
|
|
197
|
+
* @param progress_callback Progress callback (can be NULL)
|
|
198
|
+
* @param complete_callback Completion callback
|
|
199
|
+
* @param callback_user_data User context for callbacks
|
|
200
|
+
* @param out_task_id Output: Task ID for cancellation (owned, must be freed)
|
|
201
|
+
* @param user_data Platform context
|
|
202
|
+
* @return RAC_SUCCESS if download started, error code otherwise
|
|
203
|
+
*/
|
|
204
|
+
rac_result_t (*http_download)(const char* url, const char* destination_path,
|
|
205
|
+
rac_http_progress_callback_fn progress_callback,
|
|
206
|
+
rac_http_complete_callback_fn complete_callback,
|
|
207
|
+
void* callback_user_data, char** out_task_id, void* user_data);
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Cancel an HTTP download.
|
|
211
|
+
* Can be NULL.
|
|
212
|
+
*
|
|
213
|
+
* @param task_id Task ID returned from http_download
|
|
214
|
+
* @param user_data Platform context
|
|
215
|
+
* @return RAC_SUCCESS if cancelled, error code otherwise
|
|
216
|
+
*/
|
|
217
|
+
rac_result_t (*http_download_cancel)(const char* task_id, void* user_data);
|
|
218
|
+
|
|
219
|
+
// -------------------------------------------------------------------------
|
|
220
|
+
// Archive Extraction (Optional - can be NULL)
|
|
221
|
+
// -------------------------------------------------------------------------
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Extract an archive (ZIP or TAR).
|
|
225
|
+
* Can be NULL - extraction will be handled by Swift/Kotlin.
|
|
226
|
+
*
|
|
227
|
+
* @param archive_path Path to the archive
|
|
228
|
+
* @param destination_dir Where to extract files
|
|
229
|
+
* @param progress_callback Progress callback (can be NULL)
|
|
230
|
+
* @param callback_user_data User context for callback
|
|
231
|
+
* @param user_data Platform context
|
|
232
|
+
* @return RAC_SUCCESS if extracted, error code otherwise
|
|
233
|
+
*/
|
|
234
|
+
rac_result_t (*extract_archive)(const char* archive_path, const char* destination_dir,
|
|
235
|
+
rac_extract_progress_callback_fn progress_callback,
|
|
236
|
+
void* callback_user_data, void* user_data);
|
|
237
|
+
|
|
238
|
+
// -------------------------------------------------------------------------
|
|
239
|
+
// User Data
|
|
240
|
+
// -------------------------------------------------------------------------
|
|
241
|
+
|
|
242
|
+
/** Platform-specific context passed to all callbacks */
|
|
243
|
+
void* user_data;
|
|
244
|
+
|
|
245
|
+
} rac_platform_adapter_t;
|
|
246
|
+
|
|
247
|
+
// =============================================================================
|
|
248
|
+
// PLATFORM ADAPTER API
|
|
249
|
+
// =============================================================================
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Sets the platform adapter.
|
|
253
|
+
*
|
|
254
|
+
* Called during rac_init() - the adapter pointer must remain valid
|
|
255
|
+
* until rac_shutdown() is called.
|
|
256
|
+
*
|
|
257
|
+
* @param adapter Platform adapter (must not be NULL)
|
|
258
|
+
* @return RAC_SUCCESS on success, error code on failure
|
|
259
|
+
*/
|
|
260
|
+
RAC_API rac_result_t rac_set_platform_adapter(const rac_platform_adapter_t* adapter);
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Gets the current platform adapter.
|
|
264
|
+
*
|
|
265
|
+
* @return The current adapter, or NULL if not set
|
|
266
|
+
*/
|
|
267
|
+
RAC_API const rac_platform_adapter_t* rac_get_platform_adapter(void);
|
|
268
|
+
|
|
269
|
+
// =============================================================================
|
|
270
|
+
// CONVENIENCE FUNCTIONS (use platform adapter internally)
|
|
271
|
+
// =============================================================================
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Log a message using the platform adapter.
|
|
275
|
+
* @param level Log level
|
|
276
|
+
* @param category Category string
|
|
277
|
+
* @param message Message string
|
|
278
|
+
*/
|
|
279
|
+
RAC_API void rac_log(rac_log_level_t level, const char* category, const char* message);
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Get current time in milliseconds.
|
|
283
|
+
* @return Current time in milliseconds since epoch
|
|
284
|
+
*/
|
|
285
|
+
RAC_API int64_t rac_get_current_time_ms(void);
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Start an HTTP download using the platform adapter.
|
|
289
|
+
* Returns RAC_ERROR_NOT_SUPPORTED if http_download callback is NULL.
|
|
290
|
+
*
|
|
291
|
+
* @param url URL to download
|
|
292
|
+
* @param destination_path Where to save
|
|
293
|
+
* @param progress_callback Progress callback (can be NULL)
|
|
294
|
+
* @param complete_callback Completion callback
|
|
295
|
+
* @param callback_user_data User data for callbacks
|
|
296
|
+
* @param out_task_id Output: Task ID (owned, must be freed)
|
|
297
|
+
* @return RAC_SUCCESS if started, error code otherwise
|
|
298
|
+
*/
|
|
299
|
+
RAC_API rac_result_t rac_http_download(const char* url, const char* destination_path,
|
|
300
|
+
rac_http_progress_callback_fn progress_callback,
|
|
301
|
+
rac_http_complete_callback_fn complete_callback,
|
|
302
|
+
void* callback_user_data, char** out_task_id);
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Cancel an HTTP download.
|
|
306
|
+
* Returns RAC_ERROR_NOT_SUPPORTED if http_download_cancel callback is NULL.
|
|
307
|
+
*
|
|
308
|
+
* @param task_id Task ID to cancel
|
|
309
|
+
* @return RAC_SUCCESS if cancelled, error code otherwise
|
|
310
|
+
*/
|
|
311
|
+
RAC_API rac_result_t rac_http_download_cancel(const char* task_id);
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Extract an archive using the platform adapter.
|
|
315
|
+
* Returns RAC_ERROR_NOT_SUPPORTED if extract_archive callback is NULL.
|
|
316
|
+
*
|
|
317
|
+
* @param archive_path Path to archive
|
|
318
|
+
* @param destination_dir Where to extract
|
|
319
|
+
* @param progress_callback Progress callback (can be NULL)
|
|
320
|
+
* @param callback_user_data User data for callback
|
|
321
|
+
* @return RAC_SUCCESS if extracted, error code otherwise
|
|
322
|
+
*/
|
|
323
|
+
RAC_API rac_result_t rac_extract_archive(const char* archive_path, const char* destination_dir,
|
|
324
|
+
rac_extract_progress_callback_fn progress_callback,
|
|
325
|
+
void* callback_user_data);
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Check if a model framework is a platform service (Swift-native).
|
|
329
|
+
* Platform services are handled via service registry callbacks, not C++ backends.
|
|
330
|
+
*
|
|
331
|
+
* @param framework Framework to check
|
|
332
|
+
* @return RAC_TRUE if platform service, RAC_FALSE if C++ backend
|
|
333
|
+
*/
|
|
334
|
+
RAC_API rac_bool_t rac_framework_is_platform_service(rac_inference_framework_t framework);
|
|
335
|
+
|
|
336
|
+
#ifdef __cplusplus
|
|
337
|
+
}
|
|
338
|
+
#endif
|
|
339
|
+
|
|
340
|
+
#endif /* RAC_PLATFORM_ADAPTER_H */
|
package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_sdk_state.h
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file rac_sdk_state.h
|
|
3
|
+
* @brief Centralized SDK state management (C++ equivalent of ServiceContainer)
|
|
4
|
+
*
|
|
5
|
+
* This is the single source of truth for all SDK runtime state.
|
|
6
|
+
* Platform SDKs (Swift, Kotlin, Flutter) should query state from here
|
|
7
|
+
* rather than maintaining their own copies.
|
|
8
|
+
*
|
|
9
|
+
* Pattern mirrors Swift's ServiceContainer:
|
|
10
|
+
* - Singleton access via rac_state_get_instance()
|
|
11
|
+
* - Lazy initialization for sub-components
|
|
12
|
+
* - Thread-safe access via internal mutex
|
|
13
|
+
* - Reset capability for testing
|
|
14
|
+
*
|
|
15
|
+
* State Categories:
|
|
16
|
+
* 1. Auth State - Tokens, user/org IDs, authentication status
|
|
17
|
+
* 2. Device State - Device ID, registration status
|
|
18
|
+
* 3. Environment - SDK environment, API key, base URL
|
|
19
|
+
* 4. Services - Telemetry manager, model registry handles
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
#ifndef RAC_SDK_STATE_H
|
|
23
|
+
#define RAC_SDK_STATE_H
|
|
24
|
+
|
|
25
|
+
#include <stdbool.h>
|
|
26
|
+
#include <stdint.h>
|
|
27
|
+
|
|
28
|
+
#include <RACommons/rac_types.h> // For rac_result_t, RAC_SUCCESS
|
|
29
|
+
#include <RACommons/rac_environment.h> // For rac_environment_t
|
|
30
|
+
|
|
31
|
+
#ifdef __cplusplus
|
|
32
|
+
extern "C" {
|
|
33
|
+
#endif
|
|
34
|
+
|
|
35
|
+
// =============================================================================
|
|
36
|
+
// State Structure (Opaque - internal structure hidden from C API)
|
|
37
|
+
// =============================================================================
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @brief Opaque handle to SDK state
|
|
41
|
+
*
|
|
42
|
+
* The internal structure is hidden to allow C++ implementation
|
|
43
|
+
* while exposing a clean C API for platform interop.
|
|
44
|
+
*/
|
|
45
|
+
typedef struct rac_sdk_state* rac_sdk_state_handle_t;
|
|
46
|
+
|
|
47
|
+
// =============================================================================
|
|
48
|
+
// Auth Data Input Structure (Public - for platform to populate)
|
|
49
|
+
// =============================================================================
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @brief Authentication data input
|
|
53
|
+
*
|
|
54
|
+
* Platforms use this to set auth state after successful HTTP authentication.
|
|
55
|
+
* C++ copies the data internally and manages lifetime.
|
|
56
|
+
*
|
|
57
|
+
* Note: This is distinct from rac_auth_state_t in rac_auth_manager.h which
|
|
58
|
+
* is the internal state structure.
|
|
59
|
+
*/
|
|
60
|
+
typedef struct {
|
|
61
|
+
const char* access_token;
|
|
62
|
+
const char* refresh_token;
|
|
63
|
+
int64_t expires_at_unix; // Unix timestamp (seconds)
|
|
64
|
+
const char* user_id; // Nullable
|
|
65
|
+
const char* organization_id;
|
|
66
|
+
const char* device_id;
|
|
67
|
+
} rac_auth_data_t;
|
|
68
|
+
|
|
69
|
+
// =============================================================================
|
|
70
|
+
// Singleton Access
|
|
71
|
+
// =============================================================================
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @brief Get the singleton SDK state instance
|
|
75
|
+
*
|
|
76
|
+
* Creates the instance on first call (lazy initialization).
|
|
77
|
+
* Thread-safe.
|
|
78
|
+
*
|
|
79
|
+
* @return Handle to the SDK state (never NULL after first call)
|
|
80
|
+
*/
|
|
81
|
+
rac_sdk_state_handle_t rac_state_get_instance(void);
|
|
82
|
+
|
|
83
|
+
// =============================================================================
|
|
84
|
+
// Initialization & Lifecycle
|
|
85
|
+
// =============================================================================
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @brief Initialize SDK state with configuration
|
|
89
|
+
*
|
|
90
|
+
* Called during SDK initialization. Sets up environment and base config.
|
|
91
|
+
*
|
|
92
|
+
* @param env The SDK environment (development, staging, production)
|
|
93
|
+
* @param api_key The API key (copied internally)
|
|
94
|
+
* @param base_url The base URL (copied internally)
|
|
95
|
+
* @param device_id The persistent device ID (copied internally)
|
|
96
|
+
* @return RAC_SUCCESS on success
|
|
97
|
+
*/
|
|
98
|
+
rac_result_t rac_state_initialize(rac_environment_t env, const char* api_key, const char* base_url,
|
|
99
|
+
const char* device_id);
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @brief Check if SDK state is initialized
|
|
103
|
+
* @return true if initialized
|
|
104
|
+
*/
|
|
105
|
+
bool rac_state_is_initialized(void);
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @brief Reset all state (for testing or re-initialization)
|
|
109
|
+
*
|
|
110
|
+
* Clears all state including auth tokens, handles, etc.
|
|
111
|
+
* Does NOT free the singleton - just resets to initial state.
|
|
112
|
+
*/
|
|
113
|
+
void rac_state_reset(void);
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @brief Shutdown and free all resources
|
|
117
|
+
*
|
|
118
|
+
* Called during SDK shutdown. Frees all memory and destroys handles.
|
|
119
|
+
*/
|
|
120
|
+
void rac_state_shutdown(void);
|
|
121
|
+
|
|
122
|
+
// =============================================================================
|
|
123
|
+
// Environment Queries
|
|
124
|
+
// =============================================================================
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @brief Get current environment
|
|
128
|
+
* @return The SDK environment
|
|
129
|
+
*/
|
|
130
|
+
rac_environment_t rac_state_get_environment(void);
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @brief Get base URL
|
|
134
|
+
* @return The base URL string (do not free)
|
|
135
|
+
*/
|
|
136
|
+
const char* rac_state_get_base_url(void);
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @brief Get API key
|
|
140
|
+
* @return The API key string (do not free)
|
|
141
|
+
*/
|
|
142
|
+
const char* rac_state_get_api_key(void);
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @brief Get device ID
|
|
146
|
+
* @return The device ID string (do not free)
|
|
147
|
+
*/
|
|
148
|
+
const char* rac_state_get_device_id(void);
|
|
149
|
+
|
|
150
|
+
// =============================================================================
|
|
151
|
+
// Auth State Management
|
|
152
|
+
// =============================================================================
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* @brief Set authentication state after successful auth
|
|
156
|
+
*
|
|
157
|
+
* Called by platform after HTTP auth response is received.
|
|
158
|
+
* Copies all strings internally.
|
|
159
|
+
*
|
|
160
|
+
* @param auth The auth data to set
|
|
161
|
+
* @return RAC_SUCCESS on success
|
|
162
|
+
*/
|
|
163
|
+
rac_result_t rac_state_set_auth(const rac_auth_data_t* auth);
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* @brief Get current access token
|
|
167
|
+
* @return Access token string or NULL if not authenticated (do not free)
|
|
168
|
+
*/
|
|
169
|
+
const char* rac_state_get_access_token(void);
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* @brief Get current refresh token
|
|
173
|
+
* @return Refresh token string or NULL (do not free)
|
|
174
|
+
*/
|
|
175
|
+
const char* rac_state_get_refresh_token(void);
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* @brief Check if currently authenticated
|
|
179
|
+
* @return true if authenticated with valid (non-expired) token
|
|
180
|
+
*/
|
|
181
|
+
bool rac_state_is_authenticated(void);
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* @brief Check if token needs refresh
|
|
185
|
+
*
|
|
186
|
+
* Returns true if token expires within the next 60 seconds.
|
|
187
|
+
*
|
|
188
|
+
* @return true if refresh is needed
|
|
189
|
+
*/
|
|
190
|
+
bool rac_state_token_needs_refresh(void);
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @brief Get token expiry timestamp
|
|
194
|
+
* @return Unix timestamp (seconds) when token expires, or 0 if not set
|
|
195
|
+
*/
|
|
196
|
+
int64_t rac_state_get_token_expires_at(void);
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* @brief Get user ID
|
|
200
|
+
* @return User ID string or NULL (do not free)
|
|
201
|
+
*/
|
|
202
|
+
const char* rac_state_get_user_id(void);
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* @brief Get organization ID
|
|
206
|
+
* @return Organization ID string or NULL (do not free)
|
|
207
|
+
*/
|
|
208
|
+
const char* rac_state_get_organization_id(void);
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* @brief Clear authentication state
|
|
212
|
+
*
|
|
213
|
+
* Called on logout or auth failure. Clears tokens but not device/env config.
|
|
214
|
+
*/
|
|
215
|
+
void rac_state_clear_auth(void);
|
|
216
|
+
|
|
217
|
+
// =============================================================================
|
|
218
|
+
// Device State Management
|
|
219
|
+
// =============================================================================
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* @brief Set device registration status
|
|
223
|
+
* @param registered Whether device is registered with backend
|
|
224
|
+
*/
|
|
225
|
+
void rac_state_set_device_registered(bool registered);
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* @brief Check if device is registered
|
|
229
|
+
* @return true if device has been registered
|
|
230
|
+
*/
|
|
231
|
+
bool rac_state_is_device_registered(void);
|
|
232
|
+
|
|
233
|
+
// =============================================================================
|
|
234
|
+
// State Change Callbacks (for platform observers)
|
|
235
|
+
// =============================================================================
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* @brief Callback type for auth state changes
|
|
239
|
+
* @param is_authenticated Current auth status
|
|
240
|
+
* @param user_data User-provided context
|
|
241
|
+
*/
|
|
242
|
+
typedef void (*rac_auth_changed_callback_t)(bool is_authenticated, void* user_data);
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* @brief Register callback for auth state changes
|
|
246
|
+
*
|
|
247
|
+
* Called whenever auth state changes (login, logout, token refresh).
|
|
248
|
+
*
|
|
249
|
+
* @param callback The callback function (NULL to unregister)
|
|
250
|
+
* @param user_data Context passed to callback
|
|
251
|
+
*/
|
|
252
|
+
void rac_state_on_auth_changed(rac_auth_changed_callback_t callback, void* user_data);
|
|
253
|
+
|
|
254
|
+
// =============================================================================
|
|
255
|
+
// Persistence Bridge (Platform implements secure storage)
|
|
256
|
+
// =============================================================================
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* @brief Callback type for persisting state to secure storage
|
|
260
|
+
* @param key The key to store under
|
|
261
|
+
* @param value The value to store (NULL to delete)
|
|
262
|
+
* @param user_data User-provided context
|
|
263
|
+
*/
|
|
264
|
+
typedef void (*rac_persist_callback_t)(const char* key, const char* value, void* user_data);
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* @brief Callback type for loading state from secure storage
|
|
268
|
+
* @param key The key to load
|
|
269
|
+
* @param user_data User-provided context
|
|
270
|
+
* @return The stored value or NULL (caller must NOT free)
|
|
271
|
+
*/
|
|
272
|
+
typedef const char* (*rac_load_callback_t)(const char* key, void* user_data);
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* @brief Register callbacks for secure storage
|
|
276
|
+
*
|
|
277
|
+
* Platform implements these to persist to Keychain/KeyStore.
|
|
278
|
+
* C++ calls persist_callback when state changes.
|
|
279
|
+
* C++ calls load_callback during initialization.
|
|
280
|
+
*
|
|
281
|
+
* @param persist Callback to persist a value
|
|
282
|
+
* @param load Callback to load a value
|
|
283
|
+
* @param user_data Context passed to callbacks
|
|
284
|
+
*/
|
|
285
|
+
void rac_state_set_persistence_callbacks(rac_persist_callback_t persist, rac_load_callback_t load,
|
|
286
|
+
void* user_data);
|
|
287
|
+
|
|
288
|
+
#ifdef __cplusplus
|
|
289
|
+
}
|
|
290
|
+
#endif
|
|
291
|
+
|
|
292
|
+
#endif // RAC_SDK_STATE_H
|