@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,416 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file rac_logger.h
|
|
3
|
+
* @brief RunAnywhere Commons - Structured Logging System
|
|
4
|
+
*
|
|
5
|
+
* Provides a structured logging system that:
|
|
6
|
+
* - Routes logs through the platform adapter to Swift/Kotlin
|
|
7
|
+
* - Captures source location metadata (file, line, function)
|
|
8
|
+
* - Supports log levels, categories, and structured metadata
|
|
9
|
+
* - Enables remote telemetry for production error tracking
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* RAC_LOG_INFO("LLM", "Model loaded successfully");
|
|
13
|
+
* RAC_LOG_ERROR("STT", "Failed to load model: %s", error_msg);
|
|
14
|
+
* RAC_LOG_DEBUG("VAD", "Energy level: %.2f", energy);
|
|
15
|
+
*
|
|
16
|
+
* With metadata:
|
|
17
|
+
* rac_log_with_metadata(RAC_LOG_ERROR, "ONNX", "Load failed",
|
|
18
|
+
* (rac_log_metadata_t){
|
|
19
|
+
* .model_id = "whisper-tiny",
|
|
20
|
+
* .error_code = -100,
|
|
21
|
+
* .file = __FILE__,
|
|
22
|
+
* .line = __LINE__,
|
|
23
|
+
* .function = __func__
|
|
24
|
+
* });
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
#ifndef RAC_LOGGER_H
|
|
28
|
+
#define RAC_LOGGER_H
|
|
29
|
+
|
|
30
|
+
#include <stdarg.h>
|
|
31
|
+
#include <stdint.h>
|
|
32
|
+
#include <stdio.h>
|
|
33
|
+
#include <string.h>
|
|
34
|
+
|
|
35
|
+
#include <RACommons/rac_types.h>
|
|
36
|
+
|
|
37
|
+
#ifdef __cplusplus
|
|
38
|
+
extern "C" {
|
|
39
|
+
#endif
|
|
40
|
+
|
|
41
|
+
// =============================================================================
|
|
42
|
+
// LOG METADATA STRUCTURE
|
|
43
|
+
// =============================================================================
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @brief Metadata attached to a log entry.
|
|
47
|
+
*
|
|
48
|
+
* All fields are optional - set to NULL/0 if not applicable.
|
|
49
|
+
* This metadata flows through to Swift/Kotlin for remote telemetry.
|
|
50
|
+
*/
|
|
51
|
+
typedef struct rac_log_metadata {
|
|
52
|
+
// Source location (auto-populated by macros)
|
|
53
|
+
const char* file; /**< Source file name (use __FILE__) */
|
|
54
|
+
int32_t line; /**< Source line number (use __LINE__) */
|
|
55
|
+
const char* function; /**< Function name (use __func__) */
|
|
56
|
+
|
|
57
|
+
// Error context
|
|
58
|
+
int32_t error_code; /**< Error code if applicable (0 = none) */
|
|
59
|
+
const char* error_msg; /**< Additional error message */
|
|
60
|
+
|
|
61
|
+
// Model context
|
|
62
|
+
const char* model_id; /**< Model ID if applicable */
|
|
63
|
+
const char* framework; /**< Framework name (e.g., "sherpa-onnx") */
|
|
64
|
+
|
|
65
|
+
// Custom key-value pairs (for extensibility)
|
|
66
|
+
const char* custom_key1;
|
|
67
|
+
const char* custom_value1;
|
|
68
|
+
const char* custom_key2;
|
|
69
|
+
const char* custom_value2;
|
|
70
|
+
} rac_log_metadata_t;
|
|
71
|
+
|
|
72
|
+
/** Default empty metadata */
|
|
73
|
+
#define RAC_LOG_METADATA_EMPTY \
|
|
74
|
+
(rac_log_metadata_t) { \
|
|
75
|
+
NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL \
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// =============================================================================
|
|
79
|
+
// CORE LOGGING API
|
|
80
|
+
// =============================================================================
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @brief Initialize the logging system.
|
|
84
|
+
*
|
|
85
|
+
* Call this after rac_set_platform_adapter() to enable logging.
|
|
86
|
+
* If not called, logs will fall back to stderr.
|
|
87
|
+
*
|
|
88
|
+
* @param min_level Minimum log level to output
|
|
89
|
+
* @return RAC_SUCCESS on success
|
|
90
|
+
*/
|
|
91
|
+
RAC_API rac_result_t rac_logger_init(rac_log_level_t min_level);
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @brief Shutdown the logging system.
|
|
95
|
+
*
|
|
96
|
+
* Flushes any pending logs.
|
|
97
|
+
*/
|
|
98
|
+
RAC_API void rac_logger_shutdown(void);
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @brief Set the minimum log level.
|
|
102
|
+
*
|
|
103
|
+
* Messages below this level will be filtered out.
|
|
104
|
+
*
|
|
105
|
+
* @param level Minimum log level
|
|
106
|
+
*/
|
|
107
|
+
RAC_API void rac_logger_set_min_level(rac_log_level_t level);
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @brief Get the current minimum log level.
|
|
111
|
+
*
|
|
112
|
+
* @return Current minimum log level
|
|
113
|
+
*/
|
|
114
|
+
RAC_API rac_log_level_t rac_logger_get_min_level(void);
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @brief Enable or disable fallback to stderr when platform adapter unavailable.
|
|
118
|
+
*
|
|
119
|
+
* @param enabled Whether to fallback to stderr (default: true)
|
|
120
|
+
*/
|
|
121
|
+
RAC_API void rac_logger_set_stderr_fallback(rac_bool_t enabled);
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @brief Enable or disable ALWAYS logging to stderr (in addition to platform adapter).
|
|
125
|
+
*
|
|
126
|
+
* When enabled (default: true), logs are ALWAYS written to stderr first,
|
|
127
|
+
* then forwarded to the platform adapter if available. This is essential
|
|
128
|
+
* for debugging crashes during static initialization before Swift/Kotlin
|
|
129
|
+
* is ready to receive logs.
|
|
130
|
+
*
|
|
131
|
+
* Set to false in production to reduce duplicate logging overhead.
|
|
132
|
+
*
|
|
133
|
+
* @param enabled Whether to always log to stderr (default: true)
|
|
134
|
+
*/
|
|
135
|
+
RAC_API void rac_logger_set_stderr_always(rac_bool_t enabled);
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @brief Log a message with metadata.
|
|
139
|
+
*
|
|
140
|
+
* This is the main logging function. Use the RAC_LOG_* macros for convenience.
|
|
141
|
+
*
|
|
142
|
+
* @param level Log level
|
|
143
|
+
* @param category Log category (e.g., "LLM", "STT.ONNX")
|
|
144
|
+
* @param message Log message (can include printf-style format specifiers)
|
|
145
|
+
* @param metadata Optional metadata (can be NULL)
|
|
146
|
+
*/
|
|
147
|
+
RAC_API void rac_logger_log(rac_log_level_t level, const char* category, const char* message,
|
|
148
|
+
const rac_log_metadata_t* metadata);
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* @brief Log a formatted message with metadata.
|
|
152
|
+
*
|
|
153
|
+
* @param level Log level
|
|
154
|
+
* @param category Log category
|
|
155
|
+
* @param metadata Optional metadata (can be NULL)
|
|
156
|
+
* @param format Printf-style format string
|
|
157
|
+
* @param ... Format arguments
|
|
158
|
+
*/
|
|
159
|
+
RAC_API void rac_logger_logf(rac_log_level_t level, const char* category,
|
|
160
|
+
const rac_log_metadata_t* metadata, const char* format, ...);
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* @brief Log a formatted message (variadic version).
|
|
164
|
+
*
|
|
165
|
+
* @param level Log level
|
|
166
|
+
* @param category Log category
|
|
167
|
+
* @param metadata Optional metadata
|
|
168
|
+
* @param format Printf-style format string
|
|
169
|
+
* @param args Variadic arguments
|
|
170
|
+
*/
|
|
171
|
+
RAC_API void rac_logger_logv(rac_log_level_t level, const char* category,
|
|
172
|
+
const rac_log_metadata_t* metadata, const char* format, va_list args);
|
|
173
|
+
|
|
174
|
+
// =============================================================================
|
|
175
|
+
// CONVENIENCE MACROS
|
|
176
|
+
// =============================================================================
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Helper to create metadata with source location.
|
|
180
|
+
*/
|
|
181
|
+
#define RAC_LOG_META_HERE() \
|
|
182
|
+
(rac_log_metadata_t) { \
|
|
183
|
+
__FILE__, __LINE__, __func__, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL \
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Helper to create metadata with source location and error code.
|
|
188
|
+
*/
|
|
189
|
+
#define RAC_LOG_META_ERROR(code, msg) \
|
|
190
|
+
(rac_log_metadata_t) { \
|
|
191
|
+
__FILE__, __LINE__, __func__, (code), (msg), NULL, NULL, NULL, NULL, NULL, NULL \
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Helper to create metadata with model context.
|
|
196
|
+
*/
|
|
197
|
+
#define RAC_LOG_META_MODEL(mid, fw) \
|
|
198
|
+
(rac_log_metadata_t) { \
|
|
199
|
+
__FILE__, __LINE__, __func__, 0, NULL, (mid), (fw), NULL, NULL, NULL, NULL \
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// --- Level-specific logging macros with automatic source location ---
|
|
203
|
+
|
|
204
|
+
#define RAC_LOG_TRACE(category, ...) \
|
|
205
|
+
do { \
|
|
206
|
+
rac_log_metadata_t _meta = RAC_LOG_META_HERE(); \
|
|
207
|
+
rac_logger_logf(RAC_LOG_TRACE, category, &_meta, __VA_ARGS__); \
|
|
208
|
+
} while (0)
|
|
209
|
+
|
|
210
|
+
#define RAC_LOG_DEBUG(category, ...) \
|
|
211
|
+
do { \
|
|
212
|
+
rac_log_metadata_t _meta = RAC_LOG_META_HERE(); \
|
|
213
|
+
rac_logger_logf(RAC_LOG_DEBUG, category, &_meta, __VA_ARGS__); \
|
|
214
|
+
} while (0)
|
|
215
|
+
|
|
216
|
+
#define RAC_LOG_INFO(category, ...) \
|
|
217
|
+
do { \
|
|
218
|
+
rac_log_metadata_t _meta = RAC_LOG_META_HERE(); \
|
|
219
|
+
rac_logger_logf(RAC_LOG_INFO, category, &_meta, __VA_ARGS__); \
|
|
220
|
+
} while (0)
|
|
221
|
+
|
|
222
|
+
#define RAC_LOG_WARNING(category, ...) \
|
|
223
|
+
do { \
|
|
224
|
+
rac_log_metadata_t _meta = RAC_LOG_META_HERE(); \
|
|
225
|
+
rac_logger_logf(RAC_LOG_WARNING, category, &_meta, __VA_ARGS__); \
|
|
226
|
+
} while (0)
|
|
227
|
+
|
|
228
|
+
#define RAC_LOG_ERROR(category, ...) \
|
|
229
|
+
do { \
|
|
230
|
+
rac_log_metadata_t _meta = RAC_LOG_META_HERE(); \
|
|
231
|
+
rac_logger_logf(RAC_LOG_ERROR, category, &_meta, __VA_ARGS__); \
|
|
232
|
+
} while (0)
|
|
233
|
+
|
|
234
|
+
#define RAC_LOG_FATAL(category, ...) \
|
|
235
|
+
do { \
|
|
236
|
+
rac_log_metadata_t _meta = RAC_LOG_META_HERE(); \
|
|
237
|
+
rac_logger_logf(RAC_LOG_FATAL, category, &_meta, __VA_ARGS__); \
|
|
238
|
+
} while (0)
|
|
239
|
+
|
|
240
|
+
// --- Error logging with code ---
|
|
241
|
+
|
|
242
|
+
#define RAC_LOG_ERROR_CODE(category, code, ...) \
|
|
243
|
+
do { \
|
|
244
|
+
rac_log_metadata_t _meta = RAC_LOG_META_ERROR(code, NULL); \
|
|
245
|
+
rac_logger_logf(RAC_LOG_ERROR, category, &_meta, __VA_ARGS__); \
|
|
246
|
+
} while (0)
|
|
247
|
+
|
|
248
|
+
// --- Model context logging ---
|
|
249
|
+
|
|
250
|
+
#define RAC_LOG_MODEL_INFO(category, model_id, framework, ...) \
|
|
251
|
+
do { \
|
|
252
|
+
rac_log_metadata_t _meta = RAC_LOG_META_MODEL(model_id, framework); \
|
|
253
|
+
rac_logger_logf(RAC_LOG_INFO, category, &_meta, __VA_ARGS__); \
|
|
254
|
+
} while (0)
|
|
255
|
+
|
|
256
|
+
#define RAC_LOG_MODEL_ERROR(category, model_id, framework, ...) \
|
|
257
|
+
do { \
|
|
258
|
+
rac_log_metadata_t _meta = RAC_LOG_META_MODEL(model_id, framework); \
|
|
259
|
+
rac_logger_logf(RAC_LOG_ERROR, category, &_meta, __VA_ARGS__); \
|
|
260
|
+
} while (0)
|
|
261
|
+
|
|
262
|
+
// =============================================================================
|
|
263
|
+
// LEGACY COMPATIBILITY (maps to new logging system)
|
|
264
|
+
// =============================================================================
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Legacy log_info macro - maps to RAC_LOG_INFO.
|
|
268
|
+
* @deprecated Use RAC_LOG_INFO instead.
|
|
269
|
+
*/
|
|
270
|
+
#define log_info(category, ...) RAC_LOG_INFO(category, __VA_ARGS__)
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Legacy log_debug macro - maps to RAC_LOG_DEBUG.
|
|
274
|
+
* @deprecated Use RAC_LOG_DEBUG instead.
|
|
275
|
+
*/
|
|
276
|
+
#define log_debug(category, ...) RAC_LOG_DEBUG(category, __VA_ARGS__)
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Legacy log_warning macro - maps to RAC_LOG_WARNING.
|
|
280
|
+
* @deprecated Use RAC_LOG_WARNING instead.
|
|
281
|
+
*/
|
|
282
|
+
#define log_warning(category, ...) RAC_LOG_WARNING(category, __VA_ARGS__)
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Legacy log_error macro - maps to RAC_LOG_ERROR.
|
|
286
|
+
* @deprecated Use RAC_LOG_ERROR instead.
|
|
287
|
+
*/
|
|
288
|
+
#define log_error(category, ...) RAC_LOG_ERROR(category, __VA_ARGS__)
|
|
289
|
+
|
|
290
|
+
#ifdef __cplusplus
|
|
291
|
+
}
|
|
292
|
+
#endif
|
|
293
|
+
|
|
294
|
+
// =============================================================================
|
|
295
|
+
// C++ CONVENIENCE CLASS
|
|
296
|
+
// =============================================================================
|
|
297
|
+
|
|
298
|
+
#ifdef __cplusplus
|
|
299
|
+
|
|
300
|
+
#include <sstream>
|
|
301
|
+
#include <string>
|
|
302
|
+
|
|
303
|
+
namespace rac {
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* @brief C++ Logger class for convenient logging with RAII.
|
|
307
|
+
*
|
|
308
|
+
* Usage:
|
|
309
|
+
* rac::Logger log("STT.ONNX");
|
|
310
|
+
* log.info("Model loaded: %s", model_id);
|
|
311
|
+
* log.error("Failed with code %d", error_code);
|
|
312
|
+
*/
|
|
313
|
+
class Logger {
|
|
314
|
+
public:
|
|
315
|
+
explicit Logger(const char* category) : category_(category) {}
|
|
316
|
+
explicit Logger(const std::string& category) : category_(category.c_str()) {}
|
|
317
|
+
|
|
318
|
+
void trace(const char* format, ...) const {
|
|
319
|
+
va_list args;
|
|
320
|
+
va_start(args, format);
|
|
321
|
+
rac_logger_logv(RAC_LOG_TRACE, category_, nullptr, format, args);
|
|
322
|
+
va_end(args);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
void debug(const char* format, ...) const {
|
|
326
|
+
va_list args;
|
|
327
|
+
va_start(args, format);
|
|
328
|
+
rac_logger_logv(RAC_LOG_DEBUG, category_, nullptr, format, args);
|
|
329
|
+
va_end(args);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
void info(const char* format, ...) const {
|
|
333
|
+
va_list args;
|
|
334
|
+
va_start(args, format);
|
|
335
|
+
rac_logger_logv(RAC_LOG_INFO, category_, nullptr, format, args);
|
|
336
|
+
va_end(args);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
void warning(const char* format, ...) const {
|
|
340
|
+
va_list args;
|
|
341
|
+
va_start(args, format);
|
|
342
|
+
rac_logger_logv(RAC_LOG_WARNING, category_, nullptr, format, args);
|
|
343
|
+
va_end(args);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
void error(const char* format, ...) const {
|
|
347
|
+
va_list args;
|
|
348
|
+
va_start(args, format);
|
|
349
|
+
rac_logger_logv(RAC_LOG_ERROR, category_, nullptr, format, args);
|
|
350
|
+
va_end(args);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
void error(int32_t code, const char* format, ...) const {
|
|
354
|
+
rac_log_metadata_t meta = RAC_LOG_METADATA_EMPTY;
|
|
355
|
+
meta.error_code = code;
|
|
356
|
+
|
|
357
|
+
va_list args;
|
|
358
|
+
va_start(args, format);
|
|
359
|
+
rac_logger_logv(RAC_LOG_ERROR, category_, &meta, format, args);
|
|
360
|
+
va_end(args);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
void fatal(const char* format, ...) const {
|
|
364
|
+
va_list args;
|
|
365
|
+
va_start(args, format);
|
|
366
|
+
rac_logger_logv(RAC_LOG_FATAL, category_, nullptr, format, args);
|
|
367
|
+
va_end(args);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// Log with model context
|
|
371
|
+
void modelInfo(const char* model_id, const char* framework, const char* format, ...) const {
|
|
372
|
+
rac_log_metadata_t meta = RAC_LOG_METADATA_EMPTY;
|
|
373
|
+
meta.model_id = model_id;
|
|
374
|
+
meta.framework = framework;
|
|
375
|
+
|
|
376
|
+
va_list args;
|
|
377
|
+
va_start(args, format);
|
|
378
|
+
rac_logger_logv(RAC_LOG_INFO, category_, &meta, format, args);
|
|
379
|
+
va_end(args);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
void modelError(const char* model_id, const char* framework, int32_t code, const char* format,
|
|
383
|
+
...) const {
|
|
384
|
+
rac_log_metadata_t meta = RAC_LOG_METADATA_EMPTY;
|
|
385
|
+
meta.model_id = model_id;
|
|
386
|
+
meta.framework = framework;
|
|
387
|
+
meta.error_code = code;
|
|
388
|
+
|
|
389
|
+
va_list args;
|
|
390
|
+
va_start(args, format);
|
|
391
|
+
rac_logger_logv(RAC_LOG_ERROR, category_, &meta, format, args);
|
|
392
|
+
va_end(args);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
private:
|
|
396
|
+
const char* category_;
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
// Predefined loggers for common categories
|
|
400
|
+
namespace log {
|
|
401
|
+
inline Logger llm("LLM");
|
|
402
|
+
inline Logger stt("STT");
|
|
403
|
+
inline Logger tts("TTS");
|
|
404
|
+
inline Logger vad("VAD");
|
|
405
|
+
inline Logger onnx("ONNX");
|
|
406
|
+
inline Logger llamacpp("LlamaCpp");
|
|
407
|
+
inline Logger download("Download");
|
|
408
|
+
inline Logger models("Models");
|
|
409
|
+
inline Logger core("Core");
|
|
410
|
+
} // namespace log
|
|
411
|
+
|
|
412
|
+
} // namespace rac
|
|
413
|
+
|
|
414
|
+
#endif // __cplusplus
|
|
415
|
+
|
|
416
|
+
#endif /* RAC_LOGGER_H */
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file rac_model_assignment.h
|
|
3
|
+
* @brief Model Assignment Manager - Fetches models assigned to device from backend
|
|
4
|
+
*
|
|
5
|
+
* Handles fetching model assignments from the backend API.
|
|
6
|
+
* Business logic (caching, JSON parsing, registry saving) is in C++.
|
|
7
|
+
* Platform SDKs provide HTTP GET callback for network transport.
|
|
8
|
+
*
|
|
9
|
+
* Events are emitted via rac_analytics_event_emit().
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
#ifndef RAC_MODEL_ASSIGNMENT_H
|
|
13
|
+
#define RAC_MODEL_ASSIGNMENT_H
|
|
14
|
+
|
|
15
|
+
#include <RACommons/rac_types.h>
|
|
16
|
+
#include <RACommons/rac_model_types.h>
|
|
17
|
+
|
|
18
|
+
#ifdef __cplusplus
|
|
19
|
+
extern "C" {
|
|
20
|
+
#endif
|
|
21
|
+
|
|
22
|
+
// =============================================================================
|
|
23
|
+
// CALLBACK TYPES
|
|
24
|
+
// =============================================================================
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @brief HTTP response for model assignment fetch
|
|
28
|
+
*/
|
|
29
|
+
typedef struct rac_assignment_http_response {
|
|
30
|
+
rac_result_t result; // RAC_SUCCESS on success
|
|
31
|
+
int32_t status_code; // HTTP status code (200, 400, etc.)
|
|
32
|
+
const char* response_body; // Response JSON (must remain valid during processing)
|
|
33
|
+
size_t response_length; // Length of response body
|
|
34
|
+
const char* error_message; // Error message (can be NULL)
|
|
35
|
+
} rac_assignment_http_response_t;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @brief Device info for model assignment request
|
|
39
|
+
*/
|
|
40
|
+
typedef struct rac_assignment_device_info {
|
|
41
|
+
const char* device_type; // e.g., "iPhone15,2"
|
|
42
|
+
const char* platform; // e.g., "iOS"
|
|
43
|
+
} rac_assignment_device_info_t;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Make HTTP GET request for model assignments
|
|
47
|
+
* @param endpoint Full endpoint URL with query params
|
|
48
|
+
* @param requires_auth Whether authentication header is required
|
|
49
|
+
* @param out_response Output parameter for response
|
|
50
|
+
* @param user_data User-provided context
|
|
51
|
+
* @return RAC_SUCCESS on success, error code otherwise
|
|
52
|
+
*/
|
|
53
|
+
typedef rac_result_t (*rac_assignment_http_get_fn)(const char* endpoint, rac_bool_t requires_auth,
|
|
54
|
+
rac_assignment_http_response_t* out_response,
|
|
55
|
+
void* user_data);
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Get device info for model assignment request
|
|
59
|
+
* @param out_info Output parameter for device info
|
|
60
|
+
* @param user_data User-provided context
|
|
61
|
+
*/
|
|
62
|
+
typedef void (*rac_assignment_get_device_info_fn)(rac_assignment_device_info_t* out_info,
|
|
63
|
+
void* user_data);
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @brief Callback structure for model assignment operations
|
|
67
|
+
*/
|
|
68
|
+
typedef struct rac_assignment_callbacks {
|
|
69
|
+
/** Make HTTP GET request */
|
|
70
|
+
rac_assignment_http_get_fn http_get;
|
|
71
|
+
|
|
72
|
+
/** Get device info for request */
|
|
73
|
+
rac_assignment_get_device_info_fn get_device_info;
|
|
74
|
+
|
|
75
|
+
/** User data passed to all callbacks */
|
|
76
|
+
void* user_data;
|
|
77
|
+
} rac_assignment_callbacks_t;
|
|
78
|
+
|
|
79
|
+
// =============================================================================
|
|
80
|
+
// MODEL ASSIGNMENT API
|
|
81
|
+
// =============================================================================
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @brief Set callbacks for model assignment operations
|
|
85
|
+
*
|
|
86
|
+
* Must be called before any other model assignment functions.
|
|
87
|
+
* Typically called during SDK initialization.
|
|
88
|
+
*
|
|
89
|
+
* @param callbacks Callback structure (copied internally)
|
|
90
|
+
* @return RAC_SUCCESS or error code
|
|
91
|
+
*/
|
|
92
|
+
RAC_API rac_result_t
|
|
93
|
+
rac_model_assignment_set_callbacks(const rac_assignment_callbacks_t* callbacks);
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @brief Fetch model assignments from backend
|
|
97
|
+
*
|
|
98
|
+
* Fetches models assigned to this device from the backend API.
|
|
99
|
+
* Results are cached for cache_timeout_seconds.
|
|
100
|
+
*
|
|
101
|
+
* Business logic:
|
|
102
|
+
* 1. Check cache if not force_refresh
|
|
103
|
+
* 2. Get device info (via callback)
|
|
104
|
+
* 3. Build endpoint URL
|
|
105
|
+
* 4. Make HTTP GET (via callback)
|
|
106
|
+
* 5. Parse JSON response
|
|
107
|
+
* 6. Save models to registry
|
|
108
|
+
* 7. Update cache
|
|
109
|
+
* 8. Emit analytics event
|
|
110
|
+
*
|
|
111
|
+
* @param force_refresh If true, bypass cache
|
|
112
|
+
* @param out_models Output array of model infos (caller must free with rac_model_info_array_free)
|
|
113
|
+
* @param out_count Number of models returned
|
|
114
|
+
* @return RAC_SUCCESS on success, error code otherwise
|
|
115
|
+
*/
|
|
116
|
+
RAC_API rac_result_t rac_model_assignment_fetch(rac_bool_t force_refresh,
|
|
117
|
+
rac_model_info_t*** out_models, size_t* out_count);
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @brief Get cached model assignments for a specific framework
|
|
121
|
+
*
|
|
122
|
+
* Filters cached models by framework. Does not make network request.
|
|
123
|
+
* Call rac_model_assignment_fetch first to populate cache.
|
|
124
|
+
*
|
|
125
|
+
* @param framework Framework to filter by
|
|
126
|
+
* @param out_models Output array of model infos (caller must free)
|
|
127
|
+
* @param out_count Number of models returned
|
|
128
|
+
* @return RAC_SUCCESS on success, error code otherwise
|
|
129
|
+
*/
|
|
130
|
+
RAC_API rac_result_t rac_model_assignment_get_by_framework(rac_inference_framework_t framework,
|
|
131
|
+
rac_model_info_t*** out_models,
|
|
132
|
+
size_t* out_count);
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @brief Get cached model assignments for a specific category
|
|
136
|
+
*
|
|
137
|
+
* Filters cached models by category. Does not make network request.
|
|
138
|
+
* Call rac_model_assignment_fetch first to populate cache.
|
|
139
|
+
*
|
|
140
|
+
* @param category Category to filter by
|
|
141
|
+
* @param out_models Output array of model infos (caller must free)
|
|
142
|
+
* @param out_count Number of models returned
|
|
143
|
+
* @return RAC_SUCCESS on success, error code otherwise
|
|
144
|
+
*/
|
|
145
|
+
RAC_API rac_result_t rac_model_assignment_get_by_category(rac_model_category_t category,
|
|
146
|
+
rac_model_info_t*** out_models,
|
|
147
|
+
size_t* out_count);
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @brief Clear model assignment cache
|
|
151
|
+
*
|
|
152
|
+
* Clears the in-memory cache. Next fetch will make network request.
|
|
153
|
+
*/
|
|
154
|
+
RAC_API void rac_model_assignment_clear_cache(void);
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* @brief Set cache timeout in seconds
|
|
158
|
+
*
|
|
159
|
+
* Default is 3600 (1 hour).
|
|
160
|
+
*
|
|
161
|
+
* @param timeout_seconds Cache timeout in seconds
|
|
162
|
+
*/
|
|
163
|
+
RAC_API void rac_model_assignment_set_cache_timeout(uint32_t timeout_seconds);
|
|
164
|
+
|
|
165
|
+
#ifdef __cplusplus
|
|
166
|
+
}
|
|
167
|
+
#endif
|
|
168
|
+
|
|
169
|
+
#endif /* RAC_MODEL_ASSIGNMENT_H */
|