@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,594 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file rac_structured_error.h
|
|
3
|
+
* @brief RunAnywhere Commons - Structured Error System
|
|
4
|
+
*
|
|
5
|
+
* Provides a comprehensive structured error type that mirrors Swift's SDKError.
|
|
6
|
+
* This is the source of truth for error structures across all platforms
|
|
7
|
+
* (Swift, Kotlin, React Native, Flutter).
|
|
8
|
+
*
|
|
9
|
+
* Features:
|
|
10
|
+
* - Error codes and categories matching Swift's ErrorCode and ErrorCategory
|
|
11
|
+
* - Stack trace capture (platform-dependent)
|
|
12
|
+
* - Structured metadata for telemetry
|
|
13
|
+
* - Serialization to JSON for remote logging
|
|
14
|
+
*
|
|
15
|
+
* Usage:
|
|
16
|
+
* rac_error_t* error = rac_error_create(RAC_ERROR_MODEL_NOT_FOUND,
|
|
17
|
+
* RAC_CATEGORY_STT,
|
|
18
|
+
* "Model not found: whisper-tiny.en");
|
|
19
|
+
* rac_error_set_model_context(error, "whisper-tiny.en", "sherpa-onnx");
|
|
20
|
+
* rac_error_capture_stack_trace(error);
|
|
21
|
+
* // ... use error ...
|
|
22
|
+
* rac_error_destroy(error);
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
#ifndef RAC_STRUCTURED_ERROR_H
|
|
26
|
+
#define RAC_STRUCTURED_ERROR_H
|
|
27
|
+
|
|
28
|
+
#include <stdint.h>
|
|
29
|
+
|
|
30
|
+
#include <RACommons/rac_error.h>
|
|
31
|
+
#include <RACommons/rac_types.h>
|
|
32
|
+
|
|
33
|
+
#ifdef __cplusplus
|
|
34
|
+
extern "C" {
|
|
35
|
+
#endif
|
|
36
|
+
|
|
37
|
+
// =============================================================================
|
|
38
|
+
// ERROR CATEGORIES
|
|
39
|
+
// =============================================================================
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @brief Error categories matching Swift's ErrorCategory.
|
|
43
|
+
*
|
|
44
|
+
* These define which component/modality an error belongs to.
|
|
45
|
+
*/
|
|
46
|
+
typedef enum rac_error_category {
|
|
47
|
+
RAC_CATEGORY_GENERAL = 0, /**< General SDK errors */
|
|
48
|
+
RAC_CATEGORY_STT = 1, /**< Speech-to-Text errors */
|
|
49
|
+
RAC_CATEGORY_TTS = 2, /**< Text-to-Speech errors */
|
|
50
|
+
RAC_CATEGORY_LLM = 3, /**< Large Language Model errors */
|
|
51
|
+
RAC_CATEGORY_VAD = 4, /**< Voice Activity Detection errors */
|
|
52
|
+
RAC_CATEGORY_VLM = 5, /**< Vision Language Model errors */
|
|
53
|
+
RAC_CATEGORY_SPEAKER_DIARIZATION = 6, /**< Speaker Diarization errors */
|
|
54
|
+
RAC_CATEGORY_WAKE_WORD = 7, /**< Wake Word Detection errors */
|
|
55
|
+
RAC_CATEGORY_VOICE_AGENT = 8, /**< Voice Agent errors */
|
|
56
|
+
RAC_CATEGORY_DOWNLOAD = 9, /**< Download errors */
|
|
57
|
+
RAC_CATEGORY_FILE_MANAGEMENT = 10, /**< File management errors */
|
|
58
|
+
RAC_CATEGORY_NETWORK = 11, /**< Network errors */
|
|
59
|
+
RAC_CATEGORY_AUTHENTICATION = 12, /**< Authentication errors */
|
|
60
|
+
RAC_CATEGORY_SECURITY = 13, /**< Security errors */
|
|
61
|
+
RAC_CATEGORY_RUNTIME = 14, /**< Runtime/backend errors */
|
|
62
|
+
} rac_error_category_t;
|
|
63
|
+
|
|
64
|
+
// =============================================================================
|
|
65
|
+
// STACK FRAME
|
|
66
|
+
// =============================================================================
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @brief A single frame in a stack trace.
|
|
70
|
+
*/
|
|
71
|
+
typedef struct rac_stack_frame {
|
|
72
|
+
const char* function; /**< Function name */
|
|
73
|
+
const char* file; /**< Source file name */
|
|
74
|
+
int32_t line; /**< Line number */
|
|
75
|
+
void* address; /**< Memory address (for symbolication) */
|
|
76
|
+
} rac_stack_frame_t;
|
|
77
|
+
|
|
78
|
+
// =============================================================================
|
|
79
|
+
// STRUCTURED ERROR
|
|
80
|
+
// =============================================================================
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @brief Maximum number of stack frames to capture.
|
|
84
|
+
*/
|
|
85
|
+
#define RAC_MAX_STACK_FRAMES 32
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @brief Maximum length of error message.
|
|
89
|
+
*/
|
|
90
|
+
#define RAC_MAX_ERROR_MESSAGE 1024
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @brief Maximum length of metadata strings.
|
|
94
|
+
*/
|
|
95
|
+
#define RAC_MAX_METADATA_STRING 256
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @brief Structured error type matching Swift's SDKError.
|
|
99
|
+
*
|
|
100
|
+
* Contains all information needed for error reporting, logging, and telemetry.
|
|
101
|
+
*/
|
|
102
|
+
typedef struct rac_error {
|
|
103
|
+
// Core error info
|
|
104
|
+
rac_result_t code; /**< Error code (RAC_ERROR_*) */
|
|
105
|
+
rac_error_category_t category; /**< Error category */
|
|
106
|
+
char message[RAC_MAX_ERROR_MESSAGE]; /**< Human-readable message */
|
|
107
|
+
|
|
108
|
+
// Source location where error occurred
|
|
109
|
+
char source_file[RAC_MAX_METADATA_STRING]; /**< Source file name */
|
|
110
|
+
int32_t source_line; /**< Source line number */
|
|
111
|
+
char source_function[RAC_MAX_METADATA_STRING]; /**< Function name */
|
|
112
|
+
|
|
113
|
+
// Stack trace
|
|
114
|
+
rac_stack_frame_t stack_frames[RAC_MAX_STACK_FRAMES];
|
|
115
|
+
int32_t stack_frame_count;
|
|
116
|
+
|
|
117
|
+
// Underlying error (optional)
|
|
118
|
+
rac_result_t underlying_code; /**< Underlying error code (0 if none) */
|
|
119
|
+
char underlying_message[RAC_MAX_ERROR_MESSAGE]; /**< Underlying error message */
|
|
120
|
+
|
|
121
|
+
// Context metadata
|
|
122
|
+
char model_id[RAC_MAX_METADATA_STRING]; /**< Model ID if applicable */
|
|
123
|
+
char framework[RAC_MAX_METADATA_STRING]; /**< Framework (e.g., "sherpa-onnx") */
|
|
124
|
+
char session_id[RAC_MAX_METADATA_STRING]; /**< Session ID for correlation */
|
|
125
|
+
|
|
126
|
+
// Timing
|
|
127
|
+
int64_t timestamp_ms; /**< When error occurred (unix ms) */
|
|
128
|
+
|
|
129
|
+
// Custom metadata (key-value pairs for extensibility)
|
|
130
|
+
char custom_key1[64];
|
|
131
|
+
char custom_value1[RAC_MAX_METADATA_STRING];
|
|
132
|
+
char custom_key2[64];
|
|
133
|
+
char custom_value2[RAC_MAX_METADATA_STRING];
|
|
134
|
+
char custom_key3[64];
|
|
135
|
+
char custom_value3[RAC_MAX_METADATA_STRING];
|
|
136
|
+
} rac_error_t;
|
|
137
|
+
|
|
138
|
+
// =============================================================================
|
|
139
|
+
// ERROR CREATION & DESTRUCTION
|
|
140
|
+
// =============================================================================
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* @brief Creates a new structured error.
|
|
144
|
+
*
|
|
145
|
+
* @param code Error code (RAC_ERROR_*)
|
|
146
|
+
* @param category Error category
|
|
147
|
+
* @param message Human-readable error message
|
|
148
|
+
* @return New error instance (caller must call rac_error_destroy)
|
|
149
|
+
*/
|
|
150
|
+
RAC_API rac_error_t* rac_error_create(rac_result_t code, rac_error_category_t category,
|
|
151
|
+
const char* message);
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @brief Creates an error with source location.
|
|
155
|
+
*
|
|
156
|
+
* Use the RAC_ERROR_HERE macro for convenient source location capture.
|
|
157
|
+
*
|
|
158
|
+
* @param code Error code
|
|
159
|
+
* @param category Error category
|
|
160
|
+
* @param message Error message
|
|
161
|
+
* @param file Source file (__FILE__)
|
|
162
|
+
* @param line Source line (__LINE__)
|
|
163
|
+
* @param function Function name (__func__)
|
|
164
|
+
* @return New error instance
|
|
165
|
+
*/
|
|
166
|
+
RAC_API rac_error_t* rac_error_create_at(rac_result_t code, rac_error_category_t category,
|
|
167
|
+
const char* message, const char* file, int32_t line,
|
|
168
|
+
const char* function);
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* @brief Creates an error with formatted message.
|
|
172
|
+
*
|
|
173
|
+
* @param code Error code
|
|
174
|
+
* @param category Error category
|
|
175
|
+
* @param format Printf-style format string
|
|
176
|
+
* @param ... Format arguments
|
|
177
|
+
* @return New error instance
|
|
178
|
+
*/
|
|
179
|
+
RAC_API rac_error_t* rac_error_createf(rac_result_t code, rac_error_category_t category,
|
|
180
|
+
const char* format, ...);
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* @brief Destroys a structured error and frees memory.
|
|
184
|
+
*
|
|
185
|
+
* @param error Error to destroy (can be NULL)
|
|
186
|
+
*/
|
|
187
|
+
RAC_API void rac_error_destroy(rac_error_t* error);
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* @brief Creates a copy of an error.
|
|
191
|
+
*
|
|
192
|
+
* @param error Error to copy
|
|
193
|
+
* @return New copy of the error (caller must destroy)
|
|
194
|
+
*/
|
|
195
|
+
RAC_API rac_error_t* rac_error_copy(const rac_error_t* error);
|
|
196
|
+
|
|
197
|
+
// =============================================================================
|
|
198
|
+
// ERROR CONFIGURATION
|
|
199
|
+
// =============================================================================
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @brief Sets the source location for an error.
|
|
203
|
+
*
|
|
204
|
+
* @param error Error to modify
|
|
205
|
+
* @param file Source file name
|
|
206
|
+
* @param line Source line number
|
|
207
|
+
* @param function Function name
|
|
208
|
+
*/
|
|
209
|
+
RAC_API void rac_error_set_source(rac_error_t* error, const char* file, int32_t line,
|
|
210
|
+
const char* function);
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @brief Sets the underlying error.
|
|
214
|
+
*
|
|
215
|
+
* @param error Error to modify
|
|
216
|
+
* @param underlying_code Underlying error code
|
|
217
|
+
* @param underlying_message Underlying error message
|
|
218
|
+
*/
|
|
219
|
+
RAC_API void rac_error_set_underlying(rac_error_t* error, rac_result_t underlying_code,
|
|
220
|
+
const char* underlying_message);
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* @brief Sets model context for the error.
|
|
224
|
+
*
|
|
225
|
+
* @param error Error to modify
|
|
226
|
+
* @param model_id Model ID
|
|
227
|
+
* @param framework Framework name (e.g., "sherpa-onnx", "llama.cpp")
|
|
228
|
+
*/
|
|
229
|
+
RAC_API void rac_error_set_model_context(rac_error_t* error, const char* model_id,
|
|
230
|
+
const char* framework);
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* @brief Sets session ID for correlation.
|
|
234
|
+
*
|
|
235
|
+
* @param error Error to modify
|
|
236
|
+
* @param session_id Session ID
|
|
237
|
+
*/
|
|
238
|
+
RAC_API void rac_error_set_session(rac_error_t* error, const char* session_id);
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* @brief Sets custom metadata on the error.
|
|
242
|
+
*
|
|
243
|
+
* @param error Error to modify
|
|
244
|
+
* @param index Custom slot (0-2)
|
|
245
|
+
* @param key Metadata key
|
|
246
|
+
* @param value Metadata value
|
|
247
|
+
*/
|
|
248
|
+
RAC_API void rac_error_set_custom(rac_error_t* error, int32_t index, const char* key,
|
|
249
|
+
const char* value);
|
|
250
|
+
|
|
251
|
+
// =============================================================================
|
|
252
|
+
// STACK TRACE
|
|
253
|
+
// =============================================================================
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* @brief Captures the current stack trace into the error.
|
|
257
|
+
*
|
|
258
|
+
* Platform-dependent. On some platforms, only addresses may be captured
|
|
259
|
+
* and symbolication happens later.
|
|
260
|
+
*
|
|
261
|
+
* @param error Error to capture stack trace into
|
|
262
|
+
* @return Number of frames captured
|
|
263
|
+
*/
|
|
264
|
+
RAC_API int32_t rac_error_capture_stack_trace(rac_error_t* error);
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* @brief Adds a manual stack frame to the error.
|
|
268
|
+
*
|
|
269
|
+
* Use this when automatic stack capture is not available.
|
|
270
|
+
*
|
|
271
|
+
* @param error Error to modify
|
|
272
|
+
* @param function Function name
|
|
273
|
+
* @param file File name
|
|
274
|
+
* @param line Line number
|
|
275
|
+
*/
|
|
276
|
+
RAC_API void rac_error_add_frame(rac_error_t* error, const char* function, const char* file,
|
|
277
|
+
int32_t line);
|
|
278
|
+
|
|
279
|
+
// =============================================================================
|
|
280
|
+
// ERROR INFORMATION
|
|
281
|
+
// =============================================================================
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* @brief Gets the error code name as a string.
|
|
285
|
+
*
|
|
286
|
+
* @param code Error code
|
|
287
|
+
* @return Static string with code name (e.g., "MODEL_NOT_FOUND")
|
|
288
|
+
*/
|
|
289
|
+
RAC_API const char* rac_error_code_name(rac_result_t code);
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* @brief Gets the category name as a string.
|
|
293
|
+
*
|
|
294
|
+
* @param category Error category
|
|
295
|
+
* @return Static string with category name (e.g., "stt", "llm")
|
|
296
|
+
*/
|
|
297
|
+
RAC_API const char* rac_error_category_name(rac_error_category_t category);
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* @brief Gets a recovery suggestion for the error.
|
|
301
|
+
*
|
|
302
|
+
* Mirrors Swift's SDKError.recoverySuggestion.
|
|
303
|
+
*
|
|
304
|
+
* @param code Error code
|
|
305
|
+
* @return Static string with suggestion, or NULL if none
|
|
306
|
+
*/
|
|
307
|
+
RAC_API const char* rac_error_recovery_suggestion(rac_result_t code);
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* @brief Checks if an error is expected (like cancellation).
|
|
311
|
+
*
|
|
312
|
+
* Expected errors should typically not be logged as errors.
|
|
313
|
+
*
|
|
314
|
+
* @param error Error to check
|
|
315
|
+
* @return RAC_TRUE if expected, RAC_FALSE otherwise
|
|
316
|
+
*/
|
|
317
|
+
RAC_API rac_bool_t rac_error_is_expected_error(const rac_error_t* error);
|
|
318
|
+
|
|
319
|
+
// =============================================================================
|
|
320
|
+
// SERIALIZATION
|
|
321
|
+
// =============================================================================
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* @brief Serializes error to JSON string for telemetry.
|
|
325
|
+
*
|
|
326
|
+
* Returns a compact JSON representation suitable for sending to analytics.
|
|
327
|
+
* The returned string must be freed with rac_free().
|
|
328
|
+
*
|
|
329
|
+
* @param error Error to serialize
|
|
330
|
+
* @return JSON string (caller must free), or NULL on failure
|
|
331
|
+
*/
|
|
332
|
+
RAC_API char* rac_error_to_json(const rac_error_t* error);
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* @brief Gets telemetry properties as key-value pairs.
|
|
336
|
+
*
|
|
337
|
+
* Returns essential fields for analytics/telemetry events.
|
|
338
|
+
* Keys and values must be freed by caller.
|
|
339
|
+
*
|
|
340
|
+
* @param error Error to get properties from
|
|
341
|
+
* @param out_keys Output array of keys (caller allocates, at least 10 slots)
|
|
342
|
+
* @param out_values Output array of values (caller allocates, at least 10 slots)
|
|
343
|
+
* @return Number of properties written
|
|
344
|
+
*/
|
|
345
|
+
RAC_API int32_t rac_error_get_telemetry_properties(const rac_error_t* error, char** out_keys,
|
|
346
|
+
char** out_values);
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* @brief Formats error as a human-readable string.
|
|
350
|
+
*
|
|
351
|
+
* Format: "SDKError[category.code]: message"
|
|
352
|
+
* The returned string must be freed with rac_free().
|
|
353
|
+
*
|
|
354
|
+
* @param error Error to format
|
|
355
|
+
* @return Formatted string (caller must free)
|
|
356
|
+
*/
|
|
357
|
+
RAC_API char* rac_error_to_string(const rac_error_t* error);
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* @brief Formats error with full debug info including stack trace.
|
|
361
|
+
*
|
|
362
|
+
* The returned string must be freed with rac_free().
|
|
363
|
+
*
|
|
364
|
+
* @param error Error to format
|
|
365
|
+
* @return Debug string (caller must free)
|
|
366
|
+
*/
|
|
367
|
+
RAC_API char* rac_error_to_debug_string(const rac_error_t* error);
|
|
368
|
+
|
|
369
|
+
// =============================================================================
|
|
370
|
+
// CONVENIENCE MACROS
|
|
371
|
+
// =============================================================================
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* @brief Creates an error with automatic source location capture.
|
|
375
|
+
*/
|
|
376
|
+
#define RAC_ERROR(code, category, message) \
|
|
377
|
+
rac_error_create_at(code, category, message, __FILE__, __LINE__, __func__)
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* @brief Creates an error with formatted message and source location.
|
|
381
|
+
*/
|
|
382
|
+
#define RAC_ERRORF(code, category, ...) \
|
|
383
|
+
rac_error_create_at_f(code, category, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* @brief Category-specific error macros.
|
|
387
|
+
*/
|
|
388
|
+
#define RAC_ERROR_STT(code, msg) RAC_ERROR(code, RAC_CATEGORY_STT, msg)
|
|
389
|
+
#define RAC_ERROR_TTS(code, msg) RAC_ERROR(code, RAC_CATEGORY_TTS, msg)
|
|
390
|
+
#define RAC_ERROR_LLM(code, msg) RAC_ERROR(code, RAC_CATEGORY_LLM, msg)
|
|
391
|
+
#define RAC_ERROR_VAD(code, msg) RAC_ERROR(code, RAC_CATEGORY_VAD, msg)
|
|
392
|
+
#define RAC_ERROR_GENERAL(code, msg) RAC_ERROR(code, RAC_CATEGORY_GENERAL, msg)
|
|
393
|
+
#define RAC_ERROR_NETWORK(code, msg) RAC_ERROR(code, RAC_CATEGORY_NETWORK, msg)
|
|
394
|
+
#define RAC_ERROR_DOWNLOAD(code, msg) RAC_ERROR(code, RAC_CATEGORY_DOWNLOAD, msg)
|
|
395
|
+
|
|
396
|
+
// =============================================================================
|
|
397
|
+
// GLOBAL ERROR (Thread-Local Last Error)
|
|
398
|
+
// =============================================================================
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* @brief Sets the last error for the current thread.
|
|
402
|
+
*
|
|
403
|
+
* This copies the error into thread-local storage. The original error
|
|
404
|
+
* can be destroyed after this call.
|
|
405
|
+
*
|
|
406
|
+
* @param error Error to set (can be NULL to clear)
|
|
407
|
+
*/
|
|
408
|
+
RAC_API void rac_set_last_error(const rac_error_t* error);
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* @brief Gets the last error for the current thread.
|
|
412
|
+
*
|
|
413
|
+
* @return Pointer to thread-local error (do not free), or NULL if none
|
|
414
|
+
*/
|
|
415
|
+
RAC_API const rac_error_t* rac_get_last_error(void);
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* @brief Clears the last error for the current thread.
|
|
419
|
+
*/
|
|
420
|
+
RAC_API void rac_clear_last_error(void);
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* @brief Convenience: creates, logs, and sets last error in one call.
|
|
424
|
+
*
|
|
425
|
+
* @param code Error code
|
|
426
|
+
* @param category Error category
|
|
427
|
+
* @param message Error message
|
|
428
|
+
* @return The error code (for easy return statements)
|
|
429
|
+
*/
|
|
430
|
+
RAC_API rac_result_t rac_set_error(rac_result_t code, rac_error_category_t category,
|
|
431
|
+
const char* message);
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* @brief Convenience macro to set error and return.
|
|
435
|
+
*/
|
|
436
|
+
#define RAC_RETURN_ERROR(code, category, msg) return rac_set_error(code, category, msg)
|
|
437
|
+
|
|
438
|
+
// =============================================================================
|
|
439
|
+
// UNIFIED ERROR HANDLING (Log + Track)
|
|
440
|
+
// =============================================================================
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* @brief Creates, logs, and tracks a structured error.
|
|
444
|
+
*
|
|
445
|
+
* This is the recommended way to handle errors in C++ code. It:
|
|
446
|
+
* 1. Creates a structured error with source location
|
|
447
|
+
* 2. Captures stack trace (if available)
|
|
448
|
+
* 3. Logs the error via the logging system
|
|
449
|
+
* 4. Sends to error tracking (Sentry) via platform adapter
|
|
450
|
+
* 5. Sets as last error for retrieval
|
|
451
|
+
*
|
|
452
|
+
* @param code Error code
|
|
453
|
+
* @param category Error category
|
|
454
|
+
* @param message Error message
|
|
455
|
+
* @param file Source file (__FILE__)
|
|
456
|
+
* @param line Source line (__LINE__)
|
|
457
|
+
* @param function Function name (__func__)
|
|
458
|
+
* @return The error code (for easy return statements)
|
|
459
|
+
*/
|
|
460
|
+
RAC_API rac_result_t rac_error_log_and_track(rac_result_t code, rac_error_category_t category,
|
|
461
|
+
const char* message, const char* file, int32_t line,
|
|
462
|
+
const char* function);
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* @brief Creates, logs, and tracks a structured error with model context.
|
|
466
|
+
*
|
|
467
|
+
* Same as rac_error_log_and_track but includes model information.
|
|
468
|
+
*
|
|
469
|
+
* @param code Error code
|
|
470
|
+
* @param category Error category
|
|
471
|
+
* @param message Error message
|
|
472
|
+
* @param model_id Model ID
|
|
473
|
+
* @param framework Framework name
|
|
474
|
+
* @param file Source file
|
|
475
|
+
* @param line Source line
|
|
476
|
+
* @param function Function name
|
|
477
|
+
* @return The error code
|
|
478
|
+
*/
|
|
479
|
+
RAC_API rac_result_t rac_error_log_and_track_model(rac_result_t code, rac_error_category_t category,
|
|
480
|
+
const char* message, const char* model_id,
|
|
481
|
+
const char* framework, const char* file,
|
|
482
|
+
int32_t line, const char* function);
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* @brief Convenience macro to create, log, track error and return.
|
|
486
|
+
*
|
|
487
|
+
* Usage:
|
|
488
|
+
* if (model == NULL) {
|
|
489
|
+
* RAC_RETURN_TRACKED_ERROR(RAC_ERROR_MODEL_NOT_FOUND, RAC_CATEGORY_LLM, "Model not found");
|
|
490
|
+
* }
|
|
491
|
+
*/
|
|
492
|
+
#define RAC_RETURN_TRACKED_ERROR(code, category, msg) \
|
|
493
|
+
return rac_error_log_and_track(code, category, msg, __FILE__, __LINE__, __func__)
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* @brief Convenience macro with model context.
|
|
497
|
+
*/
|
|
498
|
+
#define RAC_RETURN_TRACKED_ERROR_MODEL(code, category, msg, model_id, framework) \
|
|
499
|
+
return rac_error_log_and_track_model(code, category, msg, model_id, framework, __FILE__, \
|
|
500
|
+
__LINE__, __func__)
|
|
501
|
+
|
|
502
|
+
#ifdef __cplusplus
|
|
503
|
+
}
|
|
504
|
+
#endif
|
|
505
|
+
|
|
506
|
+
// =============================================================================
|
|
507
|
+
// C++ CONVENIENCE CLASS
|
|
508
|
+
// =============================================================================
|
|
509
|
+
|
|
510
|
+
#ifdef __cplusplus
|
|
511
|
+
|
|
512
|
+
#include <memory>
|
|
513
|
+
#include <string>
|
|
514
|
+
|
|
515
|
+
namespace rac {
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* @brief RAII wrapper for rac_error_t.
|
|
519
|
+
*/
|
|
520
|
+
class Error {
|
|
521
|
+
public:
|
|
522
|
+
Error(rac_result_t code, rac_error_category_t category, const char* message)
|
|
523
|
+
: error_(rac_error_create(code, category, message), rac_error_destroy) {}
|
|
524
|
+
|
|
525
|
+
Error(rac_error_t* error) : error_(error, rac_error_destroy) {}
|
|
526
|
+
|
|
527
|
+
// Factory methods
|
|
528
|
+
static Error stt(rac_result_t code, const char* msg) { return {code, RAC_CATEGORY_STT, msg}; }
|
|
529
|
+
static Error tts(rac_result_t code, const char* msg) { return {code, RAC_CATEGORY_TTS, msg}; }
|
|
530
|
+
static Error llm(rac_result_t code, const char* msg) { return {code, RAC_CATEGORY_LLM, msg}; }
|
|
531
|
+
static Error vad(rac_result_t code, const char* msg) { return {code, RAC_CATEGORY_VAD, msg}; }
|
|
532
|
+
static Error network(rac_result_t code, const char* msg) {
|
|
533
|
+
return {code, RAC_CATEGORY_NETWORK, msg};
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
// Accessors
|
|
537
|
+
rac_result_t code() const { return error_ ? error_->code : RAC_SUCCESS; }
|
|
538
|
+
rac_error_category_t category() const {
|
|
539
|
+
return error_ ? error_->category : RAC_CATEGORY_GENERAL;
|
|
540
|
+
}
|
|
541
|
+
const char* message() const { return error_ ? error_->message : ""; }
|
|
542
|
+
|
|
543
|
+
// Configuration
|
|
544
|
+
Error& setModelContext(const char* model_id, const char* framework) {
|
|
545
|
+
if (error_)
|
|
546
|
+
rac_error_set_model_context(error_.get(), model_id, framework);
|
|
547
|
+
return *this;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
Error& setSession(const char* session_id) {
|
|
551
|
+
if (error_)
|
|
552
|
+
rac_error_set_session(error_.get(), session_id);
|
|
553
|
+
return *this;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
Error& captureStackTrace() {
|
|
557
|
+
if (error_)
|
|
558
|
+
rac_error_capture_stack_trace(error_.get());
|
|
559
|
+
return *this;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
// Conversion
|
|
563
|
+
std::string toString() const {
|
|
564
|
+
if (!error_)
|
|
565
|
+
return "";
|
|
566
|
+
char* str = rac_error_to_string(error_.get());
|
|
567
|
+
std::string result(str ? str : "");
|
|
568
|
+
rac_free(str);
|
|
569
|
+
return result;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
std::string toJson() const {
|
|
573
|
+
if (!error_)
|
|
574
|
+
return "{}";
|
|
575
|
+
char* json = rac_error_to_json(error_.get());
|
|
576
|
+
std::string result(json ? json : "{}");
|
|
577
|
+
rac_free(json);
|
|
578
|
+
return result;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
// Raw access
|
|
582
|
+
rac_error_t* get() { return error_.get(); }
|
|
583
|
+
const rac_error_t* get() const { return error_.get(); }
|
|
584
|
+
operator bool() const { return error_ != nullptr; }
|
|
585
|
+
|
|
586
|
+
private:
|
|
587
|
+
std::unique_ptr<rac_error_t, decltype(&rac_error_destroy)> error_;
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
} // namespace rac
|
|
591
|
+
|
|
592
|
+
#endif // __cplusplus
|
|
593
|
+
|
|
594
|
+
#endif /* RAC_STRUCTURED_ERROR_H */
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file rac_stt.h
|
|
3
|
+
* @brief RunAnywhere Commons - STT API (Convenience Header)
|
|
4
|
+
*
|
|
5
|
+
* This header includes both types and service interface for convenience.
|
|
6
|
+
* For better separation of concerns, prefer including:
|
|
7
|
+
* - rac_stt_types.h for data structures only
|
|
8
|
+
* - rac_stt_service.h for the service interface
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#ifndef RAC_STT_H
|
|
12
|
+
#define RAC_STT_H
|
|
13
|
+
|
|
14
|
+
#include <RACommons/rac_stt_service.h>
|
|
15
|
+
#include <RACommons/rac_stt_types.h>
|
|
16
|
+
|
|
17
|
+
#endif /* RAC_STT_H */
|