@runanywhere/core 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RunAnywhereCore.podspec +130 -0
- package/android/CMakeLists.txt +92 -0
- package/android/build.gradle +321 -0
- package/android/consumer-rules.pro +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/cpp/cpp-adapter.cpp +271 -0
- package/android/src/main/include/rac/backends/rac_llm_llamacpp.h +218 -0
- package/android/src/main/include/rac/backends/rac_stt_onnx.h +99 -0
- package/android/src/main/include/rac/backends/rac_stt_whispercpp.h +153 -0
- package/android/src/main/include/rac/backends/rac_tts_onnx.h +71 -0
- package/android/src/main/include/rac/backends/rac_vad_onnx.h +84 -0
- package/android/src/main/include/rac/core/capabilities/rac_lifecycle.h +290 -0
- package/android/src/main/include/rac/core/rac_analytics_events.h +610 -0
- package/android/src/main/include/rac/core/rac_audio_utils.h +88 -0
- package/android/src/main/include/rac/core/rac_component_types.h +160 -0
- package/android/src/main/include/rac/core/rac_core.h +331 -0
- package/android/src/main/include/rac/core/rac_error.h +469 -0
- package/android/src/main/include/rac/core/rac_events.h +334 -0
- package/android/src/main/include/rac/core/rac_logger.h +416 -0
- package/android/src/main/include/rac/core/rac_platform_adapter.h +340 -0
- package/android/src/main/include/rac/core/rac_sdk_state.h +292 -0
- package/android/src/main/include/rac/core/rac_structured_error.h +594 -0
- package/android/src/main/include/rac/core/rac_types.h +264 -0
- package/android/src/main/include/rac/features/llm/rac_llm.h +17 -0
- package/android/src/main/include/rac/features/llm/rac_llm_analytics.h +188 -0
- package/android/src/main/include/rac/features/llm/rac_llm_component.h +228 -0
- package/android/src/main/include/rac/features/llm/rac_llm_events.h +215 -0
- package/android/src/main/include/rac/features/llm/rac_llm_metrics.h +402 -0
- package/android/src/main/include/rac/features/llm/rac_llm_service.h +163 -0
- package/android/src/main/include/rac/features/llm/rac_llm_structured_output.h +141 -0
- package/android/src/main/include/rac/features/llm/rac_llm_types.h +384 -0
- package/android/src/main/include/rac/features/platform/rac_llm_platform.h +204 -0
- package/android/src/main/include/rac/features/platform/rac_tts_platform.h +197 -0
- package/android/src/main/include/rac/features/stt/rac_stt.h +17 -0
- package/android/src/main/include/rac/features/stt/rac_stt_analytics.h +204 -0
- package/android/src/main/include/rac/features/stt/rac_stt_component.h +162 -0
- package/android/src/main/include/rac/features/stt/rac_stt_events.h +62 -0
- package/android/src/main/include/rac/features/stt/rac_stt_service.h +154 -0
- package/android/src/main/include/rac/features/stt/rac_stt_types.h +389 -0
- package/android/src/main/include/rac/features/tts/rac_tts.h +17 -0
- package/android/src/main/include/rac/features/tts/rac_tts_analytics.h +181 -0
- package/android/src/main/include/rac/features/tts/rac_tts_component.h +158 -0
- package/android/src/main/include/rac/features/tts/rac_tts_events.h +54 -0
- package/android/src/main/include/rac/features/tts/rac_tts_service.h +162 -0
- package/android/src/main/include/rac/features/tts/rac_tts_types.h +374 -0
- package/android/src/main/include/rac/features/vad/rac_vad.h +17 -0
- package/android/src/main/include/rac/features/vad/rac_vad_analytics.h +236 -0
- package/android/src/main/include/rac/features/vad/rac_vad_component.h +185 -0
- package/android/src/main/include/rac/features/vad/rac_vad_energy.h +443 -0
- package/android/src/main/include/rac/features/vad/rac_vad_events.h +76 -0
- package/android/src/main/include/rac/features/vad/rac_vad_service.h +167 -0
- package/android/src/main/include/rac/features/vad/rac_vad_types.h +244 -0
- package/android/src/main/include/rac/features/voice_agent/rac_voice_agent.h +612 -0
- package/android/src/main/include/rac/infrastructure/device/rac_device_manager.h +176 -0
- package/android/src/main/include/rac/infrastructure/download/rac_download.h +418 -0
- package/android/src/main/include/rac/infrastructure/events/rac_events.h +177 -0
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_assignment.h +169 -0
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_paths.h +258 -0
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_registry.h +357 -0
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_strategy.h +374 -0
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_types.h +613 -0
- package/android/src/main/include/rac/infrastructure/network/rac_api_types.h +335 -0
- package/android/src/main/include/rac/infrastructure/network/rac_auth_manager.h +252 -0
- package/android/src/main/include/rac/infrastructure/network/rac_dev_config.h +85 -0
- package/android/src/main/include/rac/infrastructure/network/rac_endpoints.h +102 -0
- package/android/src/main/include/rac/infrastructure/network/rac_environment.h +220 -0
- package/android/src/main/include/rac/infrastructure/network/rac_http_client.h +233 -0
- package/android/src/main/include/rac/infrastructure/storage/rac_storage_analyzer.h +286 -0
- package/android/src/main/include/rac/infrastructure/telemetry/rac_telemetry_manager.h +206 -0
- package/android/src/main/include/rac/infrastructure/telemetry/rac_telemetry_types.h +234 -0
- package/android/src/main/java/com/margelo/nitro/runanywhere/ArchiveUtility.kt +308 -0
- package/android/src/main/java/com/margelo/nitro/runanywhere/HybridRunAnywhereDeviceInfo.kt +229 -0
- package/android/src/main/java/com/margelo/nitro/runanywhere/PlatformAdapterBridge.kt +392 -0
- package/android/src/main/java/com/margelo/nitro/runanywhere/RunAnywhereCorePackage.kt +28 -0
- package/android/src/main/java/com/margelo/nitro/runanywhere/SDKLogger.kt +357 -0
- package/android/src/main/java/com/margelo/nitro/runanywhere/SecureStorageManager.kt +147 -0
- package/android/src/main/jniLibs/arm64-v8a/libc++_shared.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libomp.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/librac_commons.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/librunanywhere_jni.so +0 -0
- package/cpp/HybridRunAnywhereCore.cpp +2505 -0
- package/cpp/HybridRunAnywhereCore.hpp +271 -0
- package/cpp/bridges/AuthBridge.cpp +209 -0
- package/cpp/bridges/AuthBridge.hpp +157 -0
- package/cpp/bridges/DeviceBridge.cpp +257 -0
- package/cpp/bridges/DeviceBridge.hpp +155 -0
- package/cpp/bridges/DownloadBridge.cpp +299 -0
- package/cpp/bridges/DownloadBridge.hpp +197 -0
- package/cpp/bridges/EventBridge.cpp +125 -0
- package/cpp/bridges/EventBridge.hpp +139 -0
- package/cpp/bridges/HTTPBridge.cpp +96 -0
- package/cpp/bridges/HTTPBridge.hpp +144 -0
- package/cpp/bridges/InitBridge.cpp +1273 -0
- package/cpp/bridges/InitBridge.hpp +306 -0
- package/cpp/bridges/ModelRegistryBridge.cpp +394 -0
- package/cpp/bridges/ModelRegistryBridge.hpp +177 -0
- package/cpp/bridges/StorageBridge.cpp +269 -0
- package/cpp/bridges/StorageBridge.hpp +172 -0
- package/cpp/bridges/TelemetryBridge.cpp +352 -0
- package/cpp/bridges/TelemetryBridge.hpp +126 -0
- package/ios/.testlocal +0 -0
- package/ios/ArchiveUtility.swift +526 -0
- package/ios/ArchiveUtilityBridge.m +52 -0
- package/ios/AudioDecoder.h +38 -0
- package/ios/AudioDecoder.m +162 -0
- package/ios/Binaries/RACommons.xcframework/Info.plist +44 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/RACommons.h +67 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_analytics_events.h +610 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_api_types.h +335 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_audio_utils.h +88 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_auth_manager.h +252 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_component_types.h +160 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_core.h +331 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_dev_config.h +85 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_device_manager.h +176 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_download.h +418 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_endpoints.h +102 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_environment.h +220 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_error.h +469 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_events.h +177 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_http_client.h +233 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_lifecycle.h +290 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_analytics.h +188 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_component.h +228 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_events.h +215 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_llamacpp.h +218 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_metrics.h +402 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_platform.h +204 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_service.h +163 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_structured_output.h +141 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_types.h +384 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_logger.h +416 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_assignment.h +169 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_paths.h +258 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_registry.h +357 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_strategy.h +374 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_types.h +613 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_platform_adapter.h +340 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_sdk_state.h +292 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_storage_analyzer.h +286 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_structured_error.h +594 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_analytics.h +204 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_component.h +162 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_events.h +62 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_onnx.h +99 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_service.h +154 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_types.h +389 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_whispercpp.h +153 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_telemetry_manager.h +206 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_telemetry_types.h +234 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_analytics.h +181 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_component.h +158 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_events.h +54 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_onnx.h +71 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_platform.h +197 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_service.h +162 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_types.h +374 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_types.h +264 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_analytics.h +236 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_component.h +185 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_energy.h +443 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_events.h +76 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_onnx.h +84 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_service.h +167 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_types.h +244 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_voice_agent.h +612 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Info.plist +11 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Modules/module.modulemap +5 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/RACommons +0 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/RACommons.h +67 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_analytics_events.h +610 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_api_types.h +335 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_audio_utils.h +88 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_auth_manager.h +252 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_component_types.h +160 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_core.h +331 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_dev_config.h +85 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_device_manager.h +176 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_download.h +418 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_endpoints.h +102 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_environment.h +220 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_error.h +469 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_events.h +177 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_http_client.h +233 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_lifecycle.h +290 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_analytics.h +188 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_component.h +228 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_events.h +215 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_llamacpp.h +218 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_metrics.h +402 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_platform.h +204 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_service.h +163 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_structured_output.h +141 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_types.h +384 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_logger.h +416 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_assignment.h +169 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_paths.h +258 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_registry.h +357 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_strategy.h +374 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_types.h +613 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_platform_adapter.h +340 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_sdk_state.h +292 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_storage_analyzer.h +286 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_structured_error.h +594 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_analytics.h +204 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_component.h +162 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_events.h +62 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_onnx.h +99 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_service.h +154 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_types.h +389 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_whispercpp.h +153 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_telemetry_manager.h +206 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_telemetry_types.h +234 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_analytics.h +181 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_component.h +158 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_events.h +54 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_onnx.h +71 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_platform.h +197 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_service.h +162 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_types.h +374 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_types.h +264 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_analytics.h +236 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_component.h +185 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_energy.h +443 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_events.h +76 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_onnx.h +84 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_service.h +167 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_types.h +244 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_voice_agent.h +612 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Info.plist +11 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Modules/module.modulemap +5 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/RACommons +0 -0
- package/ios/HybridRunAnywhereDeviceInfo.swift +214 -0
- package/ios/KeychainManager.swift +116 -0
- package/ios/PlatformAdapter.swift +100 -0
- package/ios/PlatformAdapterBridge.h +152 -0
- package/ios/PlatformAdapterBridge.m +570 -0
- package/ios/RNSDKLoggerBridge.h +41 -0
- package/ios/RNSDKLoggerBridge.m +66 -0
- package/ios/SDKLogger.swift +329 -0
- package/nitro.json +20 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/c++/JHybridRunAnywhereDeviceInfoSpec.cpp +257 -0
- package/nitrogen/generated/android/c++/JHybridRunAnywhereDeviceInfoSpec.hpp +77 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/runanywhere/HybridRunAnywhereDeviceInfoSpec.kt +106 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/runanywhere/runanywherecoreOnLoad.kt +35 -0
- package/nitrogen/generated/android/runanywherecore+autolinking.cmake +82 -0
- package/nitrogen/generated/android/runanywherecore+autolinking.gradle +27 -0
- package/nitrogen/generated/android/runanywherecoreOnLoad.cpp +54 -0
- package/nitrogen/generated/android/runanywherecoreOnLoad.hpp +25 -0
- package/nitrogen/generated/ios/RunAnywhereCore+autolinking.rb +60 -0
- package/nitrogen/generated/ios/RunAnywhereCore-Swift-Cxx-Bridge.cpp +65 -0
- package/nitrogen/generated/ios/RunAnywhereCore-Swift-Cxx-Bridge.hpp +197 -0
- package/nitrogen/generated/ios/RunAnywhereCore-Swift-Cxx-Umbrella.hpp +45 -0
- package/nitrogen/generated/ios/RunAnywhereCoreAutolinking.mm +43 -0
- package/nitrogen/generated/ios/RunAnywhereCoreAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridRunAnywhereDeviceInfoSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridRunAnywhereDeviceInfoSpecSwift.hpp +173 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridRunAnywhereDeviceInfoSpec.swift +68 -0
- package/nitrogen/generated/ios/swift/HybridRunAnywhereDeviceInfoSpec_cxx.swift +366 -0
- package/nitrogen/generated/shared/c++/HybridRunAnywhereCoreSpec.cpp +92 -0
- package/nitrogen/generated/shared/c++/HybridRunAnywhereCoreSpec.hpp +138 -0
- package/nitrogen/generated/shared/c++/HybridRunAnywhereDeviceInfoSpec.cpp +33 -0
- package/nitrogen/generated/shared/c++/HybridRunAnywhereDeviceInfoSpec.hpp +75 -0
- package/package.json +76 -0
- package/react-native.config.js +14 -0
- package/src/Features/VoiceSession/AudioCaptureManager.ts +286 -0
- package/src/Features/VoiceSession/AudioPlaybackManager.ts +300 -0
- package/src/Features/VoiceSession/VoiceSessionHandle.ts +530 -0
- package/src/Features/VoiceSession/index.ts +20 -0
- package/src/Features/index.ts +7 -0
- package/src/Foundation/Constants/SDKConstants.ts +47 -0
- package/src/Foundation/Constants/index.ts +8 -0
- package/src/Foundation/DependencyInjection/ServiceContainer.ts +154 -0
- package/src/Foundation/DependencyInjection/ServiceRegistry.ts +51 -0
- package/src/Foundation/DependencyInjection/index.ts +6 -0
- package/src/Foundation/ErrorTypes/ErrorCategory.ts +184 -0
- package/src/Foundation/ErrorTypes/ErrorCodes.ts +151 -0
- package/src/Foundation/ErrorTypes/ErrorContext.ts +201 -0
- package/src/Foundation/ErrorTypes/SDKError.ts +507 -0
- package/src/Foundation/ErrorTypes/index.ts +57 -0
- package/src/Foundation/Initialization/InitializationPhase.ts +85 -0
- package/src/Foundation/Initialization/InitializationState.ts +168 -0
- package/src/Foundation/Initialization/index.ts +26 -0
- package/src/Foundation/Logging/Destinations/NativeLogBridge.ts +147 -0
- package/src/Foundation/Logging/Destinations/SentryDestination.ts +209 -0
- package/src/Foundation/Logging/Logger/SDKLogger.ts +232 -0
- package/src/Foundation/Logging/Models/LogLevel.ts +36 -0
- package/src/Foundation/Logging/Models/LoggingConfiguration.ts +117 -0
- package/src/Foundation/Logging/Services/LoggingManager.ts +407 -0
- package/src/Foundation/Logging/index.ts +59 -0
- package/src/Foundation/Security/DeviceIdentity.ts +92 -0
- package/src/Foundation/Security/SecureStorageError.ts +132 -0
- package/src/Foundation/Security/SecureStorageKeys.ts +35 -0
- package/src/Foundation/Security/SecureStorageService.ts +449 -0
- package/src/Foundation/Security/index.ts +17 -0
- package/src/Foundation/index.ts +26 -0
- package/src/Infrastructure/Events/EventPublisher.ts +165 -0
- package/src/Infrastructure/Events/SDKEvent.ts +214 -0
- package/src/Infrastructure/Events/index.ts +15 -0
- package/src/Infrastructure/index.ts +9 -0
- package/src/Public/Events/EventBus.ts +488 -0
- package/src/Public/Events/index.ts +8 -0
- package/src/Public/Extensions/RunAnywhere+Logging.ts +51 -0
- package/src/Public/Extensions/RunAnywhere+Models.ts +392 -0
- package/src/Public/Extensions/RunAnywhere+STT.ts +424 -0
- package/src/Public/Extensions/RunAnywhere+Storage.ts +151 -0
- package/src/Public/Extensions/RunAnywhere+StructuredOutput.ts +316 -0
- package/src/Public/Extensions/RunAnywhere+TTS.ts +430 -0
- package/src/Public/Extensions/RunAnywhere+TextGeneration.ts +320 -0
- package/src/Public/Extensions/RunAnywhere+VAD.ts +359 -0
- package/src/Public/Extensions/RunAnywhere+VoiceAgent.ts +225 -0
- package/src/Public/Extensions/RunAnywhere+VoiceSession.ts +155 -0
- package/src/Public/Extensions/index.ts +126 -0
- package/src/Public/RunAnywhere.ts +695 -0
- package/src/index.ts +238 -0
- package/src/native/NativeRunAnywhereCore.ts +291 -0
- package/src/native/NativeRunAnywhereModule.ts +32 -0
- package/src/native/index.ts +21 -0
- package/src/services/DownloadService.ts +282 -0
- package/src/services/FileSystem.ts +810 -0
- package/src/services/ModelRegistry.ts +246 -0
- package/src/services/Network/APIEndpoints.ts +84 -0
- package/src/services/Network/HTTPService.ts +479 -0
- package/src/services/Network/NetworkConfiguration.ts +130 -0
- package/src/services/Network/TelemetryService.ts +318 -0
- package/src/services/Network/index.ts +29 -0
- package/src/services/SystemTTSService.ts +130 -0
- package/src/services/index.ts +66 -0
- package/src/specs/RunAnywhereCore.nitro.ts +627 -0
- package/src/specs/RunAnywhereDeviceInfo.nitro.ts +73 -0
- package/src/types/LLMTypes.ts +127 -0
- package/src/types/STTTypes.ts +124 -0
- package/src/types/StructuredOutputTypes.ts +156 -0
- package/src/types/TTSTypes.ts +126 -0
- package/src/types/VADTypes.ts +70 -0
- package/src/types/VoiceAgentTypes.ts +182 -0
- package/src/types/enums.ts +258 -0
- package/src/types/events.ts +337 -0
- package/src/types/external.d.ts +142 -0
- package/src/types/index.ts +146 -0
- package/src/types/models.ts +579 -0
package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_llamacpp.h
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file rac_llm_llamacpp.h
|
|
3
|
+
* @brief RunAnywhere Core - LlamaCPP Backend RAC API
|
|
4
|
+
*
|
|
5
|
+
* Direct RAC API export from runanywhere-core's LlamaCPP backend.
|
|
6
|
+
* This header defines the public C API for LLM inference using llama.cpp.
|
|
7
|
+
*
|
|
8
|
+
* Mirrors Swift's LlamaCPPService implementation pattern.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#ifndef RAC_LLM_LLAMACPP_H
|
|
12
|
+
#define RAC_LLM_LLAMACPP_H
|
|
13
|
+
|
|
14
|
+
#include <RACommons/rac_error.h>
|
|
15
|
+
#include <RACommons/rac_types.h>
|
|
16
|
+
#include <RACommons/rac_llm.h>
|
|
17
|
+
|
|
18
|
+
#ifdef __cplusplus
|
|
19
|
+
extern "C" {
|
|
20
|
+
#endif
|
|
21
|
+
|
|
22
|
+
// =============================================================================
|
|
23
|
+
// EXPORT MACRO
|
|
24
|
+
// =============================================================================
|
|
25
|
+
|
|
26
|
+
#if defined(RAC_LLAMACPP_BUILDING)
|
|
27
|
+
#if defined(_WIN32)
|
|
28
|
+
#define RAC_LLAMACPP_API __declspec(dllexport)
|
|
29
|
+
#elif defined(__GNUC__) || defined(__clang__)
|
|
30
|
+
#define RAC_LLAMACPP_API __attribute__((visibility("default")))
|
|
31
|
+
#else
|
|
32
|
+
#define RAC_LLAMACPP_API
|
|
33
|
+
#endif
|
|
34
|
+
#else
|
|
35
|
+
#define RAC_LLAMACPP_API
|
|
36
|
+
#endif
|
|
37
|
+
|
|
38
|
+
// =============================================================================
|
|
39
|
+
// CONFIGURATION - Mirrors Swift's LlamaCPPGenerationConfig
|
|
40
|
+
// =============================================================================
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* LlamaCPP-specific configuration.
|
|
44
|
+
*
|
|
45
|
+
* Mirrors Swift's LlamaCPPGenerationConfig.
|
|
46
|
+
*/
|
|
47
|
+
typedef struct rac_llm_llamacpp_config {
|
|
48
|
+
/** Context size (0 = auto-detect from model) */
|
|
49
|
+
int32_t context_size;
|
|
50
|
+
|
|
51
|
+
/** Number of threads (0 = auto-detect) */
|
|
52
|
+
int32_t num_threads;
|
|
53
|
+
|
|
54
|
+
/** Number of layers to offload to GPU (Metal on iOS/macOS) */
|
|
55
|
+
int32_t gpu_layers;
|
|
56
|
+
|
|
57
|
+
/** Batch size for prompt processing */
|
|
58
|
+
int32_t batch_size;
|
|
59
|
+
} rac_llm_llamacpp_config_t;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Default LlamaCPP configuration.
|
|
63
|
+
*/
|
|
64
|
+
static const rac_llm_llamacpp_config_t RAC_LLM_LLAMACPP_CONFIG_DEFAULT = {
|
|
65
|
+
.context_size = 0, // Auto-detect
|
|
66
|
+
.num_threads = 0, // Auto-detect
|
|
67
|
+
.gpu_layers = -1, // All layers on GPU
|
|
68
|
+
.batch_size = 512};
|
|
69
|
+
|
|
70
|
+
// =============================================================================
|
|
71
|
+
// LLAMACPP-SPECIFIC API
|
|
72
|
+
// =============================================================================
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Creates a LlamaCPP LLM service.
|
|
76
|
+
*
|
|
77
|
+
* Mirrors Swift's LlamaCPPService.initialize(modelPath:)
|
|
78
|
+
*
|
|
79
|
+
* @param model_path Path to the GGUF model file
|
|
80
|
+
* @param config LlamaCPP-specific configuration (can be NULL for defaults)
|
|
81
|
+
* @param out_handle Output: Handle to the created service
|
|
82
|
+
* @return RAC_SUCCESS or error code
|
|
83
|
+
*/
|
|
84
|
+
RAC_LLAMACPP_API rac_result_t rac_llm_llamacpp_create(const char* model_path,
|
|
85
|
+
const rac_llm_llamacpp_config_t* config,
|
|
86
|
+
rac_handle_t* out_handle);
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Loads a GGUF model into an existing service.
|
|
90
|
+
*
|
|
91
|
+
* Mirrors Swift's LlamaCPPService.loadModel(path:config:)
|
|
92
|
+
*
|
|
93
|
+
* @param handle Service handle
|
|
94
|
+
* @param model_path Path to the GGUF model file
|
|
95
|
+
* @param config LlamaCPP configuration (can be NULL)
|
|
96
|
+
* @return RAC_SUCCESS or error code
|
|
97
|
+
*/
|
|
98
|
+
RAC_LLAMACPP_API rac_result_t rac_llm_llamacpp_load_model(rac_handle_t handle,
|
|
99
|
+
const char* model_path,
|
|
100
|
+
const rac_llm_llamacpp_config_t* config);
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Unloads the current model.
|
|
104
|
+
*
|
|
105
|
+
* Mirrors Swift's LlamaCPPService.unloadModel()
|
|
106
|
+
*
|
|
107
|
+
* @param handle Service handle
|
|
108
|
+
* @return RAC_SUCCESS or error code
|
|
109
|
+
*/
|
|
110
|
+
RAC_LLAMACPP_API rac_result_t rac_llm_llamacpp_unload_model(rac_handle_t handle);
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Checks if a model is loaded.
|
|
114
|
+
*
|
|
115
|
+
* Mirrors Swift's LlamaCPPService.isModelLoaded
|
|
116
|
+
*
|
|
117
|
+
* @param handle Service handle
|
|
118
|
+
* @return RAC_TRUE if model is loaded, RAC_FALSE otherwise
|
|
119
|
+
*/
|
|
120
|
+
RAC_LLAMACPP_API rac_bool_t rac_llm_llamacpp_is_model_loaded(rac_handle_t handle);
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Generates text completion.
|
|
124
|
+
*
|
|
125
|
+
* Mirrors Swift's LlamaCPPService.generate(prompt:config:)
|
|
126
|
+
*
|
|
127
|
+
* @param handle Service handle
|
|
128
|
+
* @param prompt Input prompt text
|
|
129
|
+
* @param options Generation options (can be NULL for defaults)
|
|
130
|
+
* @param out_result Output: Generation result (caller must free text with rac_free)
|
|
131
|
+
* @return RAC_SUCCESS or error code
|
|
132
|
+
*/
|
|
133
|
+
RAC_LLAMACPP_API rac_result_t rac_llm_llamacpp_generate(rac_handle_t handle, const char* prompt,
|
|
134
|
+
const rac_llm_options_t* options,
|
|
135
|
+
rac_llm_result_t* out_result);
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Streaming text generation callback.
|
|
139
|
+
*
|
|
140
|
+
* Mirrors Swift's streaming callback pattern.
|
|
141
|
+
*
|
|
142
|
+
* @param token Generated token string
|
|
143
|
+
* @param is_final Whether this is the final token
|
|
144
|
+
* @param user_data User-provided context
|
|
145
|
+
* @return RAC_TRUE to continue, RAC_FALSE to stop
|
|
146
|
+
*/
|
|
147
|
+
typedef rac_bool_t (*rac_llm_llamacpp_stream_callback_fn)(const char* token, rac_bool_t is_final,
|
|
148
|
+
void* user_data);
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Generates text with streaming callback.
|
|
152
|
+
*
|
|
153
|
+
* Mirrors Swift's LlamaCPPService.generateStream(prompt:config:)
|
|
154
|
+
*
|
|
155
|
+
* @param handle Service handle
|
|
156
|
+
* @param prompt Input prompt text
|
|
157
|
+
* @param options Generation options
|
|
158
|
+
* @param callback Callback for each token
|
|
159
|
+
* @param user_data User context passed to callback
|
|
160
|
+
* @return RAC_SUCCESS or error code
|
|
161
|
+
*/
|
|
162
|
+
RAC_LLAMACPP_API rac_result_t rac_llm_llamacpp_generate_stream(
|
|
163
|
+
rac_handle_t handle, const char* prompt, const rac_llm_options_t* options,
|
|
164
|
+
rac_llm_llamacpp_stream_callback_fn callback, void* user_data);
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Cancels ongoing generation.
|
|
168
|
+
*
|
|
169
|
+
* Mirrors Swift's LlamaCPPService.cancel()
|
|
170
|
+
*
|
|
171
|
+
* @param handle Service handle
|
|
172
|
+
*/
|
|
173
|
+
RAC_LLAMACPP_API void rac_llm_llamacpp_cancel(rac_handle_t handle);
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Gets model information as JSON.
|
|
177
|
+
*
|
|
178
|
+
* @param handle Service handle
|
|
179
|
+
* @param out_json Output: JSON string (caller must free with rac_free)
|
|
180
|
+
* @return RAC_SUCCESS or error code
|
|
181
|
+
*/
|
|
182
|
+
RAC_LLAMACPP_API rac_result_t rac_llm_llamacpp_get_model_info(rac_handle_t handle, char** out_json);
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Destroys a LlamaCPP LLM service.
|
|
186
|
+
*
|
|
187
|
+
* @param handle Service handle to destroy
|
|
188
|
+
*/
|
|
189
|
+
RAC_LLAMACPP_API void rac_llm_llamacpp_destroy(rac_handle_t handle);
|
|
190
|
+
|
|
191
|
+
// =============================================================================
|
|
192
|
+
// BACKEND REGISTRATION
|
|
193
|
+
// =============================================================================
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Registers the LlamaCPP backend with the commons module and service registries.
|
|
197
|
+
*
|
|
198
|
+
* Should be called once during SDK initialization.
|
|
199
|
+
* This registers:
|
|
200
|
+
* - Module: "llamacpp" with TEXT_GENERATION capability
|
|
201
|
+
* - Service provider: LlamaCPP LLM provider
|
|
202
|
+
*
|
|
203
|
+
* @return RAC_SUCCESS or error code
|
|
204
|
+
*/
|
|
205
|
+
RAC_LLAMACPP_API rac_result_t rac_backend_llamacpp_register(void);
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Unregisters the LlamaCPP backend.
|
|
209
|
+
*
|
|
210
|
+
* @return RAC_SUCCESS or error code
|
|
211
|
+
*/
|
|
212
|
+
RAC_LLAMACPP_API rac_result_t rac_backend_llamacpp_unregister(void);
|
|
213
|
+
|
|
214
|
+
#ifdef __cplusplus
|
|
215
|
+
}
|
|
216
|
+
#endif
|
|
217
|
+
|
|
218
|
+
#endif /* RAC_LLM_LLAMACPP_H */
|
package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_metrics.h
ADDED
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file rac_llm_metrics.h
|
|
3
|
+
* @brief LLM Streaming Metrics - TTFT and Token Rate Tracking
|
|
4
|
+
*
|
|
5
|
+
* C port of Swift's StreamingMetricsCollector and GenerationAnalyticsService.
|
|
6
|
+
* Swift Source: Sources/RunAnywhere/Features/LLM/LLMCapability.swift (StreamingMetricsCollector)
|
|
7
|
+
* Swift Source: Sources/RunAnywhere/Features/LLM/Analytics/GenerationAnalyticsService.swift
|
|
8
|
+
*
|
|
9
|
+
* IMPORTANT: This is a direct translation of the Swift implementation.
|
|
10
|
+
* Do NOT add features not present in the Swift code.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
#ifndef RAC_LLM_METRICS_H
|
|
14
|
+
#define RAC_LLM_METRICS_H
|
|
15
|
+
|
|
16
|
+
#include <RACommons/rac_error.h>
|
|
17
|
+
#include <RACommons/rac_types.h>
|
|
18
|
+
|
|
19
|
+
#ifdef __cplusplus
|
|
20
|
+
extern "C" {
|
|
21
|
+
#endif
|
|
22
|
+
|
|
23
|
+
// =============================================================================
|
|
24
|
+
// TYPES - Mirrors Swift's GenerationMetrics and StreamingMetricsCollector
|
|
25
|
+
// =============================================================================
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @brief Generation metrics snapshot.
|
|
29
|
+
* Mirrors Swift's GenerationMetrics struct.
|
|
30
|
+
*/
|
|
31
|
+
typedef struct rac_generation_metrics {
|
|
32
|
+
/** Total generation count */
|
|
33
|
+
int32_t total_generations;
|
|
34
|
+
|
|
35
|
+
/** Streaming generation count */
|
|
36
|
+
int32_t streaming_generations;
|
|
37
|
+
|
|
38
|
+
/** Non-streaming generation count */
|
|
39
|
+
int32_t non_streaming_generations;
|
|
40
|
+
|
|
41
|
+
/** Average time-to-first-token in ms (streaming only) */
|
|
42
|
+
double average_ttft_ms;
|
|
43
|
+
|
|
44
|
+
/** Average tokens per second */
|
|
45
|
+
double average_tokens_per_second;
|
|
46
|
+
|
|
47
|
+
/** Total input tokens processed */
|
|
48
|
+
int64_t total_input_tokens;
|
|
49
|
+
|
|
50
|
+
/** Total output tokens generated */
|
|
51
|
+
int64_t total_output_tokens;
|
|
52
|
+
|
|
53
|
+
/** Service start time (Unix timestamp ms) */
|
|
54
|
+
int64_t start_time_ms;
|
|
55
|
+
|
|
56
|
+
/** Last event time (Unix timestamp ms) */
|
|
57
|
+
int64_t last_event_time_ms;
|
|
58
|
+
} rac_generation_metrics_t;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @brief Default generation metrics.
|
|
62
|
+
*/
|
|
63
|
+
static const rac_generation_metrics_t RAC_GENERATION_METRICS_DEFAULT = {
|
|
64
|
+
.total_generations = 0,
|
|
65
|
+
.streaming_generations = 0,
|
|
66
|
+
.non_streaming_generations = 0,
|
|
67
|
+
.average_ttft_ms = 0.0,
|
|
68
|
+
.average_tokens_per_second = 0.0,
|
|
69
|
+
.total_input_tokens = 0,
|
|
70
|
+
.total_output_tokens = 0,
|
|
71
|
+
.start_time_ms = 0,
|
|
72
|
+
.last_event_time_ms = 0};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @brief Streaming generation result.
|
|
76
|
+
* Mirrors Swift's LLMGenerationResult for streaming.
|
|
77
|
+
*/
|
|
78
|
+
typedef struct rac_streaming_result {
|
|
79
|
+
/** Generated text (owned, must be freed) */
|
|
80
|
+
char* text;
|
|
81
|
+
|
|
82
|
+
/** Thinking/reasoning content if any (owned, must be freed, can be NULL) */
|
|
83
|
+
char* thinking_content;
|
|
84
|
+
|
|
85
|
+
/** Input tokens processed */
|
|
86
|
+
int32_t input_tokens;
|
|
87
|
+
|
|
88
|
+
/** Output tokens generated */
|
|
89
|
+
int32_t output_tokens;
|
|
90
|
+
|
|
91
|
+
/** Model ID used (owned, must be freed) */
|
|
92
|
+
char* model_id;
|
|
93
|
+
|
|
94
|
+
/** Total latency in milliseconds */
|
|
95
|
+
double latency_ms;
|
|
96
|
+
|
|
97
|
+
/** Tokens generated per second */
|
|
98
|
+
double tokens_per_second;
|
|
99
|
+
|
|
100
|
+
/** Time-to-first-token in milliseconds (0 if not streaming) */
|
|
101
|
+
double ttft_ms;
|
|
102
|
+
|
|
103
|
+
/** Thinking tokens (for reasoning models) */
|
|
104
|
+
int32_t thinking_tokens;
|
|
105
|
+
|
|
106
|
+
/** Response tokens (excluding thinking) */
|
|
107
|
+
int32_t response_tokens;
|
|
108
|
+
} rac_streaming_result_t;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @brief Default streaming result.
|
|
112
|
+
*/
|
|
113
|
+
static const rac_streaming_result_t RAC_STREAMING_RESULT_DEFAULT = {.text = RAC_NULL,
|
|
114
|
+
.thinking_content = RAC_NULL,
|
|
115
|
+
.input_tokens = 0,
|
|
116
|
+
.output_tokens = 0,
|
|
117
|
+
.model_id = RAC_NULL,
|
|
118
|
+
.latency_ms = 0.0,
|
|
119
|
+
.tokens_per_second = 0.0,
|
|
120
|
+
.ttft_ms = 0.0,
|
|
121
|
+
.thinking_tokens = 0,
|
|
122
|
+
.response_tokens = 0};
|
|
123
|
+
|
|
124
|
+
// =============================================================================
|
|
125
|
+
// OPAQUE HANDLES
|
|
126
|
+
// =============================================================================
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @brief Opaque handle for streaming metrics collector.
|
|
130
|
+
*/
|
|
131
|
+
typedef struct rac_streaming_metrics_collector* rac_streaming_metrics_handle_t;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* @brief Opaque handle for generation analytics service.
|
|
135
|
+
*/
|
|
136
|
+
typedef struct rac_generation_analytics* rac_generation_analytics_handle_t;
|
|
137
|
+
|
|
138
|
+
// =============================================================================
|
|
139
|
+
// STREAMING METRICS COLLECTOR API - Mirrors Swift's StreamingMetricsCollector
|
|
140
|
+
// =============================================================================
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* @brief Create a streaming metrics collector.
|
|
144
|
+
*
|
|
145
|
+
* @param model_id Model ID being used
|
|
146
|
+
* @param generation_id Unique generation identifier
|
|
147
|
+
* @param prompt_length Length of input prompt (for token estimation)
|
|
148
|
+
* @param out_handle Output: Handle to the created collector
|
|
149
|
+
* @return RAC_SUCCESS or error code
|
|
150
|
+
*/
|
|
151
|
+
RAC_API rac_result_t rac_streaming_metrics_create(const char* model_id, const char* generation_id,
|
|
152
|
+
int32_t prompt_length,
|
|
153
|
+
rac_streaming_metrics_handle_t* out_handle);
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @brief Destroy a streaming metrics collector.
|
|
157
|
+
*
|
|
158
|
+
* @param handle Collector handle
|
|
159
|
+
*/
|
|
160
|
+
RAC_API void rac_streaming_metrics_destroy(rac_streaming_metrics_handle_t handle);
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* @brief Mark the start of generation.
|
|
164
|
+
*
|
|
165
|
+
* Mirrors Swift's StreamingMetricsCollector.markStart().
|
|
166
|
+
*
|
|
167
|
+
* @param handle Collector handle
|
|
168
|
+
* @return RAC_SUCCESS or error code
|
|
169
|
+
*/
|
|
170
|
+
RAC_API rac_result_t rac_streaming_metrics_mark_start(rac_streaming_metrics_handle_t handle);
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @brief Record a token received during streaming.
|
|
174
|
+
*
|
|
175
|
+
* Mirrors Swift's StreamingMetricsCollector.recordToken(_:).
|
|
176
|
+
* First call records TTFT.
|
|
177
|
+
*
|
|
178
|
+
* @param handle Collector handle
|
|
179
|
+
* @param token Token string received
|
|
180
|
+
* @return RAC_SUCCESS or error code
|
|
181
|
+
*/
|
|
182
|
+
RAC_API rac_result_t rac_streaming_metrics_record_token(rac_streaming_metrics_handle_t handle,
|
|
183
|
+
const char* token);
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* @brief Mark generation as complete.
|
|
187
|
+
*
|
|
188
|
+
* Mirrors Swift's StreamingMetricsCollector.markComplete().
|
|
189
|
+
*
|
|
190
|
+
* @param handle Collector handle
|
|
191
|
+
* @return RAC_SUCCESS or error code
|
|
192
|
+
*/
|
|
193
|
+
RAC_API rac_result_t rac_streaming_metrics_mark_complete(rac_streaming_metrics_handle_t handle);
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* @brief Mark generation as failed.
|
|
197
|
+
*
|
|
198
|
+
* Mirrors Swift's StreamingMetricsCollector.recordError(_:).
|
|
199
|
+
*
|
|
200
|
+
* @param handle Collector handle
|
|
201
|
+
* @param error_code Error code
|
|
202
|
+
* @return RAC_SUCCESS or error code
|
|
203
|
+
*/
|
|
204
|
+
RAC_API rac_result_t rac_streaming_metrics_mark_failed(rac_streaming_metrics_handle_t handle,
|
|
205
|
+
rac_result_t error_code);
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* @brief Get the generation result.
|
|
209
|
+
*
|
|
210
|
+
* Mirrors Swift's StreamingMetricsCollector.buildResult().
|
|
211
|
+
* Only valid after markComplete() is called.
|
|
212
|
+
*
|
|
213
|
+
* @param handle Collector handle
|
|
214
|
+
* @param out_result Output: Streaming result (must be freed with rac_streaming_result_free)
|
|
215
|
+
* @return RAC_SUCCESS or error code
|
|
216
|
+
*/
|
|
217
|
+
RAC_API rac_result_t rac_streaming_metrics_get_result(rac_streaming_metrics_handle_t handle,
|
|
218
|
+
rac_streaming_result_t* out_result);
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* @brief Get current TTFT in milliseconds.
|
|
222
|
+
*
|
|
223
|
+
* @param handle Collector handle
|
|
224
|
+
* @param out_ttft_ms Output: TTFT in ms (0 if first token not yet received)
|
|
225
|
+
* @return RAC_SUCCESS or error code
|
|
226
|
+
*/
|
|
227
|
+
RAC_API rac_result_t rac_streaming_metrics_get_ttft(rac_streaming_metrics_handle_t handle,
|
|
228
|
+
double* out_ttft_ms);
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* @brief Get current token count.
|
|
232
|
+
*
|
|
233
|
+
* @param handle Collector handle
|
|
234
|
+
* @param out_token_count Output: Number of tokens recorded
|
|
235
|
+
* @return RAC_SUCCESS or error code
|
|
236
|
+
*/
|
|
237
|
+
RAC_API rac_result_t rac_streaming_metrics_get_token_count(rac_streaming_metrics_handle_t handle,
|
|
238
|
+
int32_t* out_token_count);
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* @brief Get accumulated text.
|
|
242
|
+
*
|
|
243
|
+
* @param handle Collector handle
|
|
244
|
+
* @param out_text Output: Accumulated text (owned, must be freed)
|
|
245
|
+
* @return RAC_SUCCESS or error code
|
|
246
|
+
*/
|
|
247
|
+
RAC_API rac_result_t rac_streaming_metrics_get_text(rac_streaming_metrics_handle_t handle,
|
|
248
|
+
char** out_text);
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* @brief Set actual token counts from backend.
|
|
252
|
+
*
|
|
253
|
+
* Call this with actual token counts from the LLM backend's tokenizer
|
|
254
|
+
* to get accurate telemetry instead of character-based estimation.
|
|
255
|
+
*
|
|
256
|
+
* @param handle Collector handle
|
|
257
|
+
* @param input_tokens Actual input/prompt token count (0 to use estimation)
|
|
258
|
+
* @param output_tokens Actual output/completion token count (0 to use estimation)
|
|
259
|
+
* @return RAC_SUCCESS or error code
|
|
260
|
+
*/
|
|
261
|
+
RAC_API rac_result_t rac_streaming_metrics_set_token_counts(rac_streaming_metrics_handle_t handle,
|
|
262
|
+
int32_t input_tokens,
|
|
263
|
+
int32_t output_tokens);
|
|
264
|
+
|
|
265
|
+
// =============================================================================
|
|
266
|
+
// GENERATION ANALYTICS SERVICE API - Mirrors Swift's GenerationAnalyticsService
|
|
267
|
+
// =============================================================================
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* @brief Create a generation analytics service.
|
|
271
|
+
*
|
|
272
|
+
* @param out_handle Output: Handle to the created service
|
|
273
|
+
* @return RAC_SUCCESS or error code
|
|
274
|
+
*/
|
|
275
|
+
RAC_API rac_result_t rac_generation_analytics_create(rac_generation_analytics_handle_t* out_handle);
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* @brief Destroy a generation analytics service.
|
|
279
|
+
*
|
|
280
|
+
* @param handle Service handle
|
|
281
|
+
*/
|
|
282
|
+
RAC_API void rac_generation_analytics_destroy(rac_generation_analytics_handle_t handle);
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* @brief Start tracking a non-streaming generation.
|
|
286
|
+
*
|
|
287
|
+
* Mirrors Swift's GenerationAnalyticsService.startGeneration().
|
|
288
|
+
*
|
|
289
|
+
* @param handle Service handle
|
|
290
|
+
* @param generation_id Unique generation identifier
|
|
291
|
+
* @param model_id Model ID
|
|
292
|
+
* @return RAC_SUCCESS or error code
|
|
293
|
+
*/
|
|
294
|
+
RAC_API rac_result_t rac_generation_analytics_start(rac_generation_analytics_handle_t handle,
|
|
295
|
+
const char* generation_id,
|
|
296
|
+
const char* model_id);
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* @brief Start tracking a streaming generation.
|
|
300
|
+
*
|
|
301
|
+
* Mirrors Swift's GenerationAnalyticsService.startStreamingGeneration().
|
|
302
|
+
*
|
|
303
|
+
* @param handle Service handle
|
|
304
|
+
* @param generation_id Unique generation identifier
|
|
305
|
+
* @param model_id Model ID
|
|
306
|
+
* @return RAC_SUCCESS or error code
|
|
307
|
+
*/
|
|
308
|
+
RAC_API rac_result_t rac_generation_analytics_start_streaming(
|
|
309
|
+
rac_generation_analytics_handle_t handle, const char* generation_id, const char* model_id);
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* @brief Track first token received (streaming only).
|
|
313
|
+
*
|
|
314
|
+
* Mirrors Swift's GenerationAnalyticsService.trackFirstToken().
|
|
315
|
+
*
|
|
316
|
+
* @param handle Service handle
|
|
317
|
+
* @param generation_id Generation identifier
|
|
318
|
+
* @return RAC_SUCCESS or error code
|
|
319
|
+
*/
|
|
320
|
+
RAC_API rac_result_t rac_generation_analytics_track_first_token(
|
|
321
|
+
rac_generation_analytics_handle_t handle, const char* generation_id);
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* @brief Track streaming update.
|
|
325
|
+
*
|
|
326
|
+
* Mirrors Swift's GenerationAnalyticsService.trackStreamingUpdate().
|
|
327
|
+
*
|
|
328
|
+
* @param handle Service handle
|
|
329
|
+
* @param generation_id Generation identifier
|
|
330
|
+
* @param tokens_generated Number of tokens generated so far
|
|
331
|
+
* @return RAC_SUCCESS or error code
|
|
332
|
+
*/
|
|
333
|
+
RAC_API rac_result_t rac_generation_analytics_track_streaming_update(
|
|
334
|
+
rac_generation_analytics_handle_t handle, const char* generation_id, int32_t tokens_generated);
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* @brief Complete a generation.
|
|
338
|
+
*
|
|
339
|
+
* Mirrors Swift's GenerationAnalyticsService.completeGeneration().
|
|
340
|
+
*
|
|
341
|
+
* @param handle Service handle
|
|
342
|
+
* @param generation_id Generation identifier
|
|
343
|
+
* @param input_tokens Number of input tokens
|
|
344
|
+
* @param output_tokens Number of output tokens
|
|
345
|
+
* @param model_id Model ID used
|
|
346
|
+
* @return RAC_SUCCESS or error code
|
|
347
|
+
*/
|
|
348
|
+
RAC_API rac_result_t rac_generation_analytics_complete(rac_generation_analytics_handle_t handle,
|
|
349
|
+
const char* generation_id,
|
|
350
|
+
int32_t input_tokens, int32_t output_tokens,
|
|
351
|
+
const char* model_id);
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* @brief Track generation failure.
|
|
355
|
+
*
|
|
356
|
+
* Mirrors Swift's GenerationAnalyticsService.trackGenerationFailed().
|
|
357
|
+
*
|
|
358
|
+
* @param handle Service handle
|
|
359
|
+
* @param generation_id Generation identifier
|
|
360
|
+
* @param error_code Error code
|
|
361
|
+
* @return RAC_SUCCESS or error code
|
|
362
|
+
*/
|
|
363
|
+
RAC_API rac_result_t rac_generation_analytics_track_failed(rac_generation_analytics_handle_t handle,
|
|
364
|
+
const char* generation_id,
|
|
365
|
+
rac_result_t error_code);
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* @brief Get aggregated metrics.
|
|
369
|
+
*
|
|
370
|
+
* Mirrors Swift's GenerationAnalyticsService.getMetrics().
|
|
371
|
+
*
|
|
372
|
+
* @param handle Service handle
|
|
373
|
+
* @param out_metrics Output: Generation metrics
|
|
374
|
+
* @return RAC_SUCCESS or error code
|
|
375
|
+
*/
|
|
376
|
+
RAC_API rac_result_t rac_generation_analytics_get_metrics(rac_generation_analytics_handle_t handle,
|
|
377
|
+
rac_generation_metrics_t* out_metrics);
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* @brief Reset metrics.
|
|
381
|
+
*
|
|
382
|
+
* @param handle Service handle
|
|
383
|
+
* @return RAC_SUCCESS or error code
|
|
384
|
+
*/
|
|
385
|
+
RAC_API rac_result_t rac_generation_analytics_reset(rac_generation_analytics_handle_t handle);
|
|
386
|
+
|
|
387
|
+
// =============================================================================
|
|
388
|
+
// MEMORY MANAGEMENT
|
|
389
|
+
// =============================================================================
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* @brief Free a streaming result.
|
|
393
|
+
*
|
|
394
|
+
* @param result Result to free
|
|
395
|
+
*/
|
|
396
|
+
RAC_API void rac_streaming_result_free(rac_streaming_result_t* result);
|
|
397
|
+
|
|
398
|
+
#ifdef __cplusplus
|
|
399
|
+
}
|
|
400
|
+
#endif
|
|
401
|
+
|
|
402
|
+
#endif /* RAC_LLM_METRICS_H */
|