@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,335 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file rac_api_types.h
|
|
3
|
+
* @brief API request and response data types
|
|
4
|
+
*
|
|
5
|
+
* Defines all data structures for API communication.
|
|
6
|
+
* This is the canonical source of truth - platform SDKs create thin wrappers.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
#ifndef RAC_API_TYPES_H
|
|
10
|
+
#define RAC_API_TYPES_H
|
|
11
|
+
|
|
12
|
+
#include <stdbool.h>
|
|
13
|
+
#include <stddef.h>
|
|
14
|
+
#include <stdint.h>
|
|
15
|
+
|
|
16
|
+
#ifdef __cplusplus
|
|
17
|
+
extern "C" {
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
// =============================================================================
|
|
21
|
+
// Authentication Types
|
|
22
|
+
// =============================================================================
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @brief Authentication request payload
|
|
26
|
+
* Sent to POST /api/v1/auth/sdk/authenticate
|
|
27
|
+
*/
|
|
28
|
+
typedef struct {
|
|
29
|
+
const char* api_key;
|
|
30
|
+
const char* device_id;
|
|
31
|
+
const char* platform; // "ios", "android", etc.
|
|
32
|
+
const char* sdk_version;
|
|
33
|
+
} rac_auth_request_t;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @brief Authentication response payload
|
|
37
|
+
* Received from authentication and refresh endpoints
|
|
38
|
+
*/
|
|
39
|
+
typedef struct {
|
|
40
|
+
char* access_token;
|
|
41
|
+
char* refresh_token;
|
|
42
|
+
char* device_id;
|
|
43
|
+
char* user_id; // Can be NULL (org-level auth)
|
|
44
|
+
char* organization_id;
|
|
45
|
+
char* token_type; // Usually "bearer"
|
|
46
|
+
int32_t expires_in; // Seconds until expiry
|
|
47
|
+
} rac_auth_response_t;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @brief Refresh token request payload
|
|
51
|
+
* Sent to POST /api/v1/auth/sdk/refresh
|
|
52
|
+
*/
|
|
53
|
+
typedef struct {
|
|
54
|
+
const char* device_id;
|
|
55
|
+
const char* refresh_token;
|
|
56
|
+
} rac_refresh_request_t;
|
|
57
|
+
|
|
58
|
+
// =============================================================================
|
|
59
|
+
// Health Check Types
|
|
60
|
+
// =============================================================================
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @brief Health status enum
|
|
64
|
+
*/
|
|
65
|
+
typedef enum {
|
|
66
|
+
RAC_HEALTH_HEALTHY = 0,
|
|
67
|
+
RAC_HEALTH_DEGRADED = 1,
|
|
68
|
+
RAC_HEALTH_UNHEALTHY = 2
|
|
69
|
+
} rac_health_status_t;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @brief Health check response
|
|
73
|
+
* Received from GET /v1/health
|
|
74
|
+
*/
|
|
75
|
+
typedef struct {
|
|
76
|
+
rac_health_status_t status;
|
|
77
|
+
char* version;
|
|
78
|
+
int64_t timestamp; // Unix timestamp
|
|
79
|
+
} rac_health_response_t;
|
|
80
|
+
|
|
81
|
+
// =============================================================================
|
|
82
|
+
// Device Registration Types
|
|
83
|
+
// =============================================================================
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @brief Device hardware information
|
|
87
|
+
*/
|
|
88
|
+
typedef struct {
|
|
89
|
+
const char* device_fingerprint;
|
|
90
|
+
const char* device_model; // e.g., "iPhone15,2"
|
|
91
|
+
const char* os_version; // e.g., "17.0"
|
|
92
|
+
const char* platform; // "ios", "android", etc.
|
|
93
|
+
const char* architecture; // "arm64", "x86_64", etc.
|
|
94
|
+
int64_t total_memory; // Bytes
|
|
95
|
+
int32_t cpu_cores;
|
|
96
|
+
bool has_neural_engine;
|
|
97
|
+
bool has_gpu;
|
|
98
|
+
} rac_device_info_t;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @brief Device registration request
|
|
102
|
+
* Sent to POST /api/v1/devices/register
|
|
103
|
+
*/
|
|
104
|
+
typedef struct {
|
|
105
|
+
rac_device_info_t device_info;
|
|
106
|
+
const char* sdk_version;
|
|
107
|
+
const char* build_token;
|
|
108
|
+
int64_t last_seen_at; // Unix timestamp
|
|
109
|
+
} rac_device_reg_request_t;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @brief Device registration response
|
|
113
|
+
*/
|
|
114
|
+
typedef struct {
|
|
115
|
+
char* device_id;
|
|
116
|
+
char* status; // "registered" or "updated"
|
|
117
|
+
char* sync_status; // "synced" or "pending"
|
|
118
|
+
} rac_device_reg_response_t;
|
|
119
|
+
|
|
120
|
+
// =============================================================================
|
|
121
|
+
// Telemetry Types
|
|
122
|
+
// =============================================================================
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @brief Telemetry event payload
|
|
126
|
+
* Contains all possible fields for LLM, STT, TTS, VAD events
|
|
127
|
+
*/
|
|
128
|
+
typedef struct {
|
|
129
|
+
// Required fields
|
|
130
|
+
const char* id;
|
|
131
|
+
const char* event_type;
|
|
132
|
+
int64_t timestamp; // Unix timestamp ms
|
|
133
|
+
int64_t created_at; // Unix timestamp ms
|
|
134
|
+
|
|
135
|
+
// Event classification
|
|
136
|
+
const char* modality; // "llm", "stt", "tts", "model", "system"
|
|
137
|
+
|
|
138
|
+
// Device identification
|
|
139
|
+
const char* device_id;
|
|
140
|
+
const char* session_id;
|
|
141
|
+
|
|
142
|
+
// Model info
|
|
143
|
+
const char* model_id;
|
|
144
|
+
const char* model_name;
|
|
145
|
+
const char* framework;
|
|
146
|
+
|
|
147
|
+
// Device info
|
|
148
|
+
const char* device;
|
|
149
|
+
const char* os_version;
|
|
150
|
+
const char* platform;
|
|
151
|
+
const char* sdk_version;
|
|
152
|
+
|
|
153
|
+
// Common metrics
|
|
154
|
+
double processing_time_ms;
|
|
155
|
+
bool success;
|
|
156
|
+
bool has_success; // Whether success field is set
|
|
157
|
+
const char* error_message;
|
|
158
|
+
const char* error_code;
|
|
159
|
+
|
|
160
|
+
// LLM-specific
|
|
161
|
+
int32_t input_tokens;
|
|
162
|
+
int32_t output_tokens;
|
|
163
|
+
int32_t total_tokens;
|
|
164
|
+
double tokens_per_second;
|
|
165
|
+
double time_to_first_token_ms;
|
|
166
|
+
double prompt_eval_time_ms;
|
|
167
|
+
double generation_time_ms;
|
|
168
|
+
int32_t context_length;
|
|
169
|
+
double temperature;
|
|
170
|
+
int32_t max_tokens;
|
|
171
|
+
|
|
172
|
+
// STT-specific
|
|
173
|
+
double audio_duration_ms;
|
|
174
|
+
double real_time_factor;
|
|
175
|
+
int32_t word_count;
|
|
176
|
+
double confidence;
|
|
177
|
+
const char* language;
|
|
178
|
+
bool is_streaming;
|
|
179
|
+
int32_t segment_index;
|
|
180
|
+
|
|
181
|
+
// TTS-specific
|
|
182
|
+
int32_t character_count;
|
|
183
|
+
double characters_per_second;
|
|
184
|
+
int32_t audio_size_bytes;
|
|
185
|
+
int32_t sample_rate;
|
|
186
|
+
const char* voice;
|
|
187
|
+
double output_duration_ms;
|
|
188
|
+
|
|
189
|
+
// Model lifecycle
|
|
190
|
+
int64_t model_size_bytes;
|
|
191
|
+
const char* archive_type;
|
|
192
|
+
|
|
193
|
+
// VAD-specific
|
|
194
|
+
double speech_duration_ms;
|
|
195
|
+
|
|
196
|
+
// SDK lifecycle
|
|
197
|
+
int32_t count;
|
|
198
|
+
|
|
199
|
+
// Storage
|
|
200
|
+
int64_t freed_bytes;
|
|
201
|
+
|
|
202
|
+
// Network
|
|
203
|
+
bool is_online;
|
|
204
|
+
bool has_is_online;
|
|
205
|
+
} rac_telemetry_event_t;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* @brief Telemetry batch request
|
|
209
|
+
* Sent to POST /api/v1/sdk/telemetry
|
|
210
|
+
*/
|
|
211
|
+
typedef struct {
|
|
212
|
+
rac_telemetry_event_t* events;
|
|
213
|
+
size_t event_count;
|
|
214
|
+
const char* device_id;
|
|
215
|
+
int64_t timestamp;
|
|
216
|
+
const char* modality; // Can be NULL for V1 path
|
|
217
|
+
} rac_telemetry_batch_t;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* @brief Telemetry batch response
|
|
221
|
+
*/
|
|
222
|
+
typedef struct {
|
|
223
|
+
bool success;
|
|
224
|
+
int32_t events_received;
|
|
225
|
+
int32_t events_stored;
|
|
226
|
+
int32_t events_skipped;
|
|
227
|
+
char** errors;
|
|
228
|
+
size_t error_count;
|
|
229
|
+
char* storage_version; // "V1" or "V2"
|
|
230
|
+
} rac_telemetry_response_t;
|
|
231
|
+
|
|
232
|
+
// =============================================================================
|
|
233
|
+
// API Error Types
|
|
234
|
+
// =============================================================================
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* @brief API error information
|
|
238
|
+
*/
|
|
239
|
+
typedef struct {
|
|
240
|
+
int32_t status_code;
|
|
241
|
+
char* message;
|
|
242
|
+
char* code;
|
|
243
|
+
char* raw_body;
|
|
244
|
+
char* request_url;
|
|
245
|
+
} rac_api_error_t;
|
|
246
|
+
|
|
247
|
+
// =============================================================================
|
|
248
|
+
// Memory Management
|
|
249
|
+
// =============================================================================
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* @brief Free authentication response
|
|
253
|
+
*/
|
|
254
|
+
void rac_auth_response_free(rac_auth_response_t* response);
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* @brief Free health response
|
|
258
|
+
*/
|
|
259
|
+
void rac_health_response_free(rac_health_response_t* response);
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* @brief Free device registration response
|
|
263
|
+
*/
|
|
264
|
+
void rac_device_reg_response_free(rac_device_reg_response_t* response);
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* @brief Free telemetry response
|
|
268
|
+
*/
|
|
269
|
+
void rac_telemetry_response_free(rac_telemetry_response_t* response);
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* @brief Free API error
|
|
273
|
+
*/
|
|
274
|
+
void rac_api_error_free(rac_api_error_t* error);
|
|
275
|
+
|
|
276
|
+
// =============================================================================
|
|
277
|
+
// JSON Serialization
|
|
278
|
+
// =============================================================================
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* @brief Serialize auth request to JSON
|
|
282
|
+
* @param request The request to serialize
|
|
283
|
+
* @return JSON string (caller must free), or NULL on error
|
|
284
|
+
*/
|
|
285
|
+
char* rac_auth_request_to_json(const rac_auth_request_t* request);
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* @brief Parse auth response from JSON
|
|
289
|
+
* @param json The JSON string
|
|
290
|
+
* @param out_response Output response (caller must free with rac_auth_response_free)
|
|
291
|
+
* @return 0 on success, -1 on error
|
|
292
|
+
*/
|
|
293
|
+
int rac_auth_response_from_json(const char* json, rac_auth_response_t* out_response);
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* @brief Serialize refresh request to JSON
|
|
297
|
+
*/
|
|
298
|
+
char* rac_refresh_request_to_json(const rac_refresh_request_t* request);
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* @brief Serialize device registration request to JSON
|
|
302
|
+
*/
|
|
303
|
+
char* rac_device_reg_request_to_json(const rac_device_reg_request_t* request);
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* @brief Parse device registration response from JSON
|
|
307
|
+
*/
|
|
308
|
+
int rac_device_reg_response_from_json(const char* json, rac_device_reg_response_t* out_response);
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* @brief Serialize telemetry event to JSON
|
|
312
|
+
*/
|
|
313
|
+
char* rac_telemetry_event_to_json(const rac_telemetry_event_t* event);
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* @brief Serialize telemetry batch to JSON
|
|
317
|
+
*/
|
|
318
|
+
char* rac_telemetry_batch_to_json(const rac_telemetry_batch_t* batch);
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* @brief Parse telemetry response from JSON
|
|
322
|
+
*/
|
|
323
|
+
int rac_telemetry_response_from_json(const char* json, rac_telemetry_response_t* out_response);
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* @brief Parse API error from HTTP response
|
|
327
|
+
*/
|
|
328
|
+
int rac_api_error_from_response(int status_code, const char* body, const char* url,
|
|
329
|
+
rac_api_error_t* out_error);
|
|
330
|
+
|
|
331
|
+
#ifdef __cplusplus
|
|
332
|
+
}
|
|
333
|
+
#endif
|
|
334
|
+
|
|
335
|
+
#endif // RAC_API_TYPES_H
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file rac_audio_utils.h
|
|
3
|
+
* @brief RunAnywhere Commons - Audio Utility Functions
|
|
4
|
+
*
|
|
5
|
+
* Provides audio format conversion utilities used across the SDK.
|
|
6
|
+
* This centralizes audio processing logic that was previously duplicated
|
|
7
|
+
* in Swift/Kotlin SDKs.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#ifndef RAC_AUDIO_UTILS_H
|
|
11
|
+
#define RAC_AUDIO_UTILS_H
|
|
12
|
+
|
|
13
|
+
#include <RACommons/rac_types.h>
|
|
14
|
+
#include <RACommons/rac_tts_types.h>
|
|
15
|
+
|
|
16
|
+
#ifdef __cplusplus
|
|
17
|
+
extern "C" {
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
// =============================================================================
|
|
21
|
+
// AUDIO CONVERSION API
|
|
22
|
+
// =============================================================================
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @brief Convert Float32 PCM samples to WAV format (Int16 PCM with header)
|
|
26
|
+
*
|
|
27
|
+
* TTS backends typically output raw Float32 PCM samples in range [-1.0, 1.0].
|
|
28
|
+
* This function converts them to a complete WAV file that can be played by
|
|
29
|
+
* standard audio players (AVAudioPlayer on iOS, MediaPlayer on Android, etc.).
|
|
30
|
+
*
|
|
31
|
+
* WAV format details:
|
|
32
|
+
* - RIFF header with WAVE format
|
|
33
|
+
* - fmt chunk: PCM format (1), mono (1 channel), Int16 samples
|
|
34
|
+
* - data chunk: Int16 samples (scaled from Float32)
|
|
35
|
+
*
|
|
36
|
+
* @param pcm_data Input Float32 PCM samples
|
|
37
|
+
* @param pcm_size Size of pcm_data in bytes (must be multiple of 4)
|
|
38
|
+
* @param sample_rate Sample rate in Hz (e.g., 22050 for Piper TTS)
|
|
39
|
+
* @param out_wav_data Output: WAV file data (owned, must be freed with rac_free)
|
|
40
|
+
* @param out_wav_size Output: Size of WAV data in bytes
|
|
41
|
+
* @return RAC_SUCCESS or error code
|
|
42
|
+
*
|
|
43
|
+
* @note The caller owns the returned wav_data and must free it with rac_free()
|
|
44
|
+
*
|
|
45
|
+
* Example usage:
|
|
46
|
+
* @code
|
|
47
|
+
* void* wav_data = NULL;
|
|
48
|
+
* size_t wav_size = 0;
|
|
49
|
+
* rac_result_t result = rac_audio_float32_to_wav(
|
|
50
|
+
* pcm_samples, pcm_size, RAC_TTS_DEFAULT_SAMPLE_RATE, &wav_data, &wav_size);
|
|
51
|
+
* if (result == RAC_SUCCESS) {
|
|
52
|
+
* // Use wav_data...
|
|
53
|
+
* rac_free(wav_data);
|
|
54
|
+
* }
|
|
55
|
+
* @endcode
|
|
56
|
+
*/
|
|
57
|
+
RAC_API rac_result_t rac_audio_float32_to_wav(const void* pcm_data, size_t pcm_size,
|
|
58
|
+
int32_t sample_rate, void** out_wav_data,
|
|
59
|
+
size_t* out_wav_size);
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @brief Convert Int16 PCM samples to WAV format
|
|
63
|
+
*
|
|
64
|
+
* Similar to rac_audio_float32_to_wav but for Int16 input samples.
|
|
65
|
+
*
|
|
66
|
+
* @param pcm_data Input Int16 PCM samples
|
|
67
|
+
* @param pcm_size Size of pcm_data in bytes (must be multiple of 2)
|
|
68
|
+
* @param sample_rate Sample rate in Hz
|
|
69
|
+
* @param out_wav_data Output: WAV file data (owned, must be freed with rac_free)
|
|
70
|
+
* @param out_wav_size Output: Size of WAV data in bytes
|
|
71
|
+
* @return RAC_SUCCESS or error code
|
|
72
|
+
*/
|
|
73
|
+
RAC_API rac_result_t rac_audio_int16_to_wav(const void* pcm_data, size_t pcm_size,
|
|
74
|
+
int32_t sample_rate, void** out_wav_data,
|
|
75
|
+
size_t* out_wav_size);
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @brief Get WAV header size in bytes
|
|
79
|
+
*
|
|
80
|
+
* @return WAV header size (always 44 bytes for standard PCM WAV)
|
|
81
|
+
*/
|
|
82
|
+
RAC_API size_t rac_audio_wav_header_size(void);
|
|
83
|
+
|
|
84
|
+
#ifdef __cplusplus
|
|
85
|
+
}
|
|
86
|
+
#endif
|
|
87
|
+
|
|
88
|
+
#endif /* RAC_AUDIO_UTILS_H */
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file rac_auth_manager.h
|
|
3
|
+
* @brief Authentication state management
|
|
4
|
+
*
|
|
5
|
+
* Manages authentication state including tokens, expiry, and refresh logic.
|
|
6
|
+
* Platform SDKs provide HTTP transport and secure storage callbacks.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
#ifndef RAC_AUTH_MANAGER_H
|
|
10
|
+
#define RAC_AUTH_MANAGER_H
|
|
11
|
+
|
|
12
|
+
#include <stdbool.h>
|
|
13
|
+
#include <stdint.h>
|
|
14
|
+
|
|
15
|
+
#include <RACommons/rac_api_types.h>
|
|
16
|
+
#include <RACommons/rac_environment.h>
|
|
17
|
+
|
|
18
|
+
#ifdef __cplusplus
|
|
19
|
+
extern "C" {
|
|
20
|
+
#endif
|
|
21
|
+
|
|
22
|
+
// =============================================================================
|
|
23
|
+
// Auth State
|
|
24
|
+
// =============================================================================
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @brief Authentication state structure
|
|
28
|
+
*
|
|
29
|
+
* Managed internally - use accessor functions.
|
|
30
|
+
*/
|
|
31
|
+
typedef struct {
|
|
32
|
+
char* access_token;
|
|
33
|
+
char* refresh_token;
|
|
34
|
+
char* device_id;
|
|
35
|
+
char* user_id; // Can be NULL
|
|
36
|
+
char* organization_id;
|
|
37
|
+
int64_t token_expires_at; // Unix timestamp (seconds)
|
|
38
|
+
bool is_authenticated;
|
|
39
|
+
} rac_auth_state_t;
|
|
40
|
+
|
|
41
|
+
// =============================================================================
|
|
42
|
+
// Platform Callbacks
|
|
43
|
+
// =============================================================================
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @brief Callback for secure storage operations
|
|
47
|
+
*
|
|
48
|
+
* Platform implements to store tokens in Keychain/KeyStore.
|
|
49
|
+
*/
|
|
50
|
+
typedef struct {
|
|
51
|
+
/**
|
|
52
|
+
* @brief Store string value securely
|
|
53
|
+
* @param key Storage key
|
|
54
|
+
* @param value Value to store
|
|
55
|
+
* @return 0 on success, -1 on error
|
|
56
|
+
*/
|
|
57
|
+
int (*store)(const char* key, const char* value, void* context);
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @brief Retrieve string value
|
|
61
|
+
* @param key Storage key
|
|
62
|
+
* @param out_value Output buffer (caller provides)
|
|
63
|
+
* @param buffer_size Size of output buffer
|
|
64
|
+
* @return Length of value, or -1 on error/not found
|
|
65
|
+
*/
|
|
66
|
+
int (*retrieve)(const char* key, char* out_value, size_t buffer_size, void* context);
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @brief Delete stored value
|
|
70
|
+
* @param key Storage key
|
|
71
|
+
* @return 0 on success, -1 on error
|
|
72
|
+
*/
|
|
73
|
+
int (*delete_key)(const char* key, void* context);
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @brief Context pointer passed to all callbacks
|
|
77
|
+
*/
|
|
78
|
+
void* context;
|
|
79
|
+
} rac_secure_storage_t;
|
|
80
|
+
|
|
81
|
+
// =============================================================================
|
|
82
|
+
// Keychain Keys (for platform implementations)
|
|
83
|
+
// =============================================================================
|
|
84
|
+
|
|
85
|
+
#define RAC_KEY_ACCESS_TOKEN "com.runanywhere.sdk.accessToken"
|
|
86
|
+
#define RAC_KEY_REFRESH_TOKEN "com.runanywhere.sdk.refreshToken"
|
|
87
|
+
#define RAC_KEY_DEVICE_ID "com.runanywhere.sdk.deviceId"
|
|
88
|
+
#define RAC_KEY_USER_ID "com.runanywhere.sdk.userId"
|
|
89
|
+
#define RAC_KEY_ORGANIZATION_ID "com.runanywhere.sdk.organizationId"
|
|
90
|
+
|
|
91
|
+
// =============================================================================
|
|
92
|
+
// Initialization
|
|
93
|
+
// =============================================================================
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @brief Initialize auth manager
|
|
97
|
+
* @param storage Secure storage callbacks (can be NULL for in-memory only)
|
|
98
|
+
*/
|
|
99
|
+
void rac_auth_init(const rac_secure_storage_t* storage);
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @brief Reset auth manager state
|
|
103
|
+
*/
|
|
104
|
+
void rac_auth_reset(void);
|
|
105
|
+
|
|
106
|
+
// =============================================================================
|
|
107
|
+
// Token State
|
|
108
|
+
// =============================================================================
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @brief Check if currently authenticated
|
|
112
|
+
* @return true if valid access token exists
|
|
113
|
+
*/
|
|
114
|
+
bool rac_auth_is_authenticated(void);
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @brief Check if token needs refresh
|
|
118
|
+
*
|
|
119
|
+
* Returns true if token expires within 60 seconds.
|
|
120
|
+
*
|
|
121
|
+
* @return true if token should be refreshed
|
|
122
|
+
*/
|
|
123
|
+
bool rac_auth_needs_refresh(void);
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @brief Get current access token
|
|
127
|
+
* @return Access token string, or NULL if not authenticated
|
|
128
|
+
*/
|
|
129
|
+
const char* rac_auth_get_access_token(void);
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @brief Get current device ID
|
|
133
|
+
* @return Device ID string, or NULL if not set
|
|
134
|
+
*/
|
|
135
|
+
const char* rac_auth_get_device_id(void);
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @brief Get current user ID
|
|
139
|
+
* @return User ID string, or NULL if not set
|
|
140
|
+
*/
|
|
141
|
+
const char* rac_auth_get_user_id(void);
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @brief Get current organization ID
|
|
145
|
+
* @return Organization ID string, or NULL if not set
|
|
146
|
+
*/
|
|
147
|
+
const char* rac_auth_get_organization_id(void);
|
|
148
|
+
|
|
149
|
+
// =============================================================================
|
|
150
|
+
// Request Building
|
|
151
|
+
// =============================================================================
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @brief Build authentication request JSON
|
|
155
|
+
*
|
|
156
|
+
* Creates JSON payload for POST /api/v1/auth/sdk/authenticate
|
|
157
|
+
*
|
|
158
|
+
* @param config SDK configuration with credentials
|
|
159
|
+
* @return JSON string (caller must free), or NULL on error
|
|
160
|
+
*/
|
|
161
|
+
char* rac_auth_build_authenticate_request(const rac_sdk_config_t* config);
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* @brief Build token refresh request JSON
|
|
165
|
+
*
|
|
166
|
+
* Creates JSON payload for POST /api/v1/auth/sdk/refresh
|
|
167
|
+
*
|
|
168
|
+
* @return JSON string (caller must free), or NULL if no refresh token
|
|
169
|
+
*/
|
|
170
|
+
char* rac_auth_build_refresh_request(void);
|
|
171
|
+
|
|
172
|
+
// =============================================================================
|
|
173
|
+
// Response Handling
|
|
174
|
+
// =============================================================================
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* @brief Parse and store authentication response
|
|
178
|
+
*
|
|
179
|
+
* Updates internal auth state and optionally persists to secure storage.
|
|
180
|
+
*
|
|
181
|
+
* @param json JSON response body
|
|
182
|
+
* @return 0 on success, -1 on parse error
|
|
183
|
+
*/
|
|
184
|
+
int rac_auth_handle_authenticate_response(const char* json);
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* @brief Parse and store refresh response
|
|
188
|
+
*
|
|
189
|
+
* Updates internal auth state and optionally persists to secure storage.
|
|
190
|
+
*
|
|
191
|
+
* @param json JSON response body
|
|
192
|
+
* @return 0 on success, -1 on parse error
|
|
193
|
+
*/
|
|
194
|
+
int rac_auth_handle_refresh_response(const char* json);
|
|
195
|
+
|
|
196
|
+
// =============================================================================
|
|
197
|
+
// Token Management
|
|
198
|
+
// =============================================================================
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* @brief Get valid access token, triggering refresh if needed
|
|
202
|
+
*
|
|
203
|
+
* This is the main entry point for getting a token. If the current token
|
|
204
|
+
* is expired or about to expire, it will:
|
|
205
|
+
* 1. Build a refresh request
|
|
206
|
+
* 2. Return a pending state indicating refresh is needed
|
|
207
|
+
*
|
|
208
|
+
* Platform must then:
|
|
209
|
+
* 1. Execute the HTTP request
|
|
210
|
+
* 2. Call rac_auth_handle_refresh_response with result
|
|
211
|
+
* 3. Call this function again to get the new token
|
|
212
|
+
*
|
|
213
|
+
* @param out_token Output pointer for token string
|
|
214
|
+
* @param out_needs_refresh Set to true if refresh HTTP call is needed
|
|
215
|
+
* @return 0 on success (token valid), 1 if refresh needed, -1 on error
|
|
216
|
+
*/
|
|
217
|
+
int rac_auth_get_valid_token(const char** out_token, bool* out_needs_refresh);
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* @brief Clear all authentication state
|
|
221
|
+
*
|
|
222
|
+
* Clears in-memory state and secure storage.
|
|
223
|
+
*/
|
|
224
|
+
void rac_auth_clear(void);
|
|
225
|
+
|
|
226
|
+
// =============================================================================
|
|
227
|
+
// Persistence
|
|
228
|
+
// =============================================================================
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* @brief Load tokens from secure storage
|
|
232
|
+
*
|
|
233
|
+
* Call during initialization to restore saved auth state.
|
|
234
|
+
*
|
|
235
|
+
* @return 0 on success (tokens loaded), -1 if not found or error
|
|
236
|
+
*/
|
|
237
|
+
int rac_auth_load_stored_tokens(void);
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* @brief Save current tokens to secure storage
|
|
241
|
+
*
|
|
242
|
+
* Called automatically by response handlers, but can be called manually.
|
|
243
|
+
*
|
|
244
|
+
* @return 0 on success, -1 on error
|
|
245
|
+
*/
|
|
246
|
+
int rac_auth_save_tokens(void);
|
|
247
|
+
|
|
248
|
+
#ifdef __cplusplus
|
|
249
|
+
}
|
|
250
|
+
#endif
|
|
251
|
+
|
|
252
|
+
#endif // RAC_AUTH_MANAGER_H
|